All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.rxjava.amqp.AmqpConnection Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR2
Show newest version
/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.rxjava.amqp;

import rx.Observable;
import rx.Single;
import io.vertx.rx.java.RxHelper;
import io.vertx.rx.java.WriteStreamSubscriber;
import io.vertx.rx.java.SingleOnSubscribeAdapter;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;

/**
 * Once connected to the broker or router, you get a connection. This connection is automatically opened.
 *
 * 

* NOTE: This class has been automatically generated from the {@link io.vertx.amqp.AmqpConnection original} non RX-ified interface using Vert.x codegen. */ @RxGen(io.vertx.amqp.AmqpConnection.class) public class AmqpConnection { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AmqpConnection that = (AmqpConnection) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new AmqpConnection((io.vertx.amqp.AmqpConnection) obj), AmqpConnection::getDelegate ); private final io.vertx.amqp.AmqpConnection delegate; public AmqpConnection(io.vertx.amqp.AmqpConnection delegate) { this.delegate = delegate; } public AmqpConnection(Object delegate) { this.delegate = (io.vertx.amqp.AmqpConnection)delegate; } public io.vertx.amqp.AmqpConnection getDelegate() { return delegate; } private static final TypeArg TYPE_ARG_0 = new TypeArg(o1 -> io.vertx.rxjava.amqp.AmqpReceiver.newInstance((io.vertx.amqp.AmqpReceiver)o1), o1 -> o1.getDelegate()); private static final TypeArg TYPE_ARG_1 = new TypeArg(o1 -> io.vertx.rxjava.amqp.AmqpReceiver.newInstance((io.vertx.amqp.AmqpReceiver)o1), o1 -> o1.getDelegate()); private static final TypeArg TYPE_ARG_2 = new TypeArg(o1 -> io.vertx.rxjava.amqp.AmqpReceiver.newInstance((io.vertx.amqp.AmqpReceiver)o1), o1 -> o1.getDelegate()); private static final TypeArg TYPE_ARG_3 = new TypeArg(o1 -> io.vertx.rxjava.amqp.AmqpSender.newInstance((io.vertx.amqp.AmqpSender)o1), o1 -> o1.getDelegate()); private static final TypeArg TYPE_ARG_4 = new TypeArg(o1 -> io.vertx.rxjava.amqp.AmqpSender.newInstance((io.vertx.amqp.AmqpSender)o1), o1 -> o1.getDelegate()); private static final TypeArg TYPE_ARG_5 = new TypeArg(o1 -> io.vertx.rxjava.amqp.AmqpSender.newInstance((io.vertx.amqp.AmqpSender)o1), o1 -> o1.getDelegate()); /** * Registers a handler called on disconnection. * @param handler the exception handler. * @return the connection */ public io.vertx.rxjava.amqp.AmqpConnection exceptionHandler(io.vertx.core.Handler handler) { delegate.exceptionHandler(handler); return this; } /** * Closes the AMQP connection, i.e. allows the Close frame to be emitted. * @return a future notified when the connection is closed */ public io.vertx.core.Future close() { io.vertx.core.Future ret = delegate.close().map(val -> val); return ret; } /** * Closes the AMQP connection, i.e. allows the Close frame to be emitted. * @return a future notified when the connection is closed */ public rx.Single rxClose() { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { this.close().onComplete(fut); })); } /** * Creates a receiver used to consume messages from the given address. The receiver has no handler and won't * start receiving messages until a handler is explicitly configured. * @param address The source address to attach the consumer to, must not be null * @return a future notified with the receiver. The receiver has been opened. */ public io.vertx.core.Future createReceiver(java.lang.String address) { io.vertx.core.Future ret = delegate.createReceiver(address).map(val -> io.vertx.rxjava.amqp.AmqpReceiver.newInstance((io.vertx.amqp.AmqpReceiver)val)); return ret; } /** * Creates a receiver used to consume messages from the given address. The receiver has no handler and won't * start receiving messages until a handler is explicitly configured. * @param address The source address to attach the consumer to, must not be null * @return a future notified with the receiver. The receiver has been opened. */ public rx.Single rxCreateReceiver(java.lang.String address) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { this.createReceiver(address).onComplete(fut); })); } /** * Creates a receiver used to consumer messages from the given address. * @param address The source address to attach the consumer to. * @param receiverOptions The options for this receiver. * @return a future notified with the receiver, once opened. Note that the messageHandler can be called before the completionHandler if messages are awaiting delivery. */ public io.vertx.core.Future createReceiver(java.lang.String address, io.vertx.amqp.AmqpReceiverOptions receiverOptions) { io.vertx.core.Future ret = delegate.createReceiver(address, receiverOptions).map(val -> io.vertx.rxjava.amqp.AmqpReceiver.newInstance((io.vertx.amqp.AmqpReceiver)val)); return ret; } /** * Creates a receiver used to consumer messages from the given address. * @param address The source address to attach the consumer to. * @param receiverOptions The options for this receiver. * @return a future notified with the receiver, once opened. Note that the messageHandler can be called before the completionHandler if messages are awaiting delivery. */ public rx.Single rxCreateReceiver(java.lang.String address, io.vertx.amqp.AmqpReceiverOptions receiverOptions) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { this.createReceiver(address, receiverOptions).onComplete(fut); })); } /** * Creates a dynamic receiver. The address is provided by the broker and is available in the completionHandler, * using the {@link io.vertx.rxjava.amqp.AmqpReceiver#address} method. this method is useful for request-reply to generate a unique * reply address. * @return a future notified when the receiver has been created and opened. */ public io.vertx.core.Future createDynamicReceiver() { io.vertx.core.Future ret = delegate.createDynamicReceiver().map(val -> io.vertx.rxjava.amqp.AmqpReceiver.newInstance((io.vertx.amqp.AmqpReceiver)val)); return ret; } /** * Creates a dynamic receiver. The address is provided by the broker and is available in the completionHandler, * using the {@link io.vertx.rxjava.amqp.AmqpReceiver#address} method. this method is useful for request-reply to generate a unique * reply address. * @return a future notified when the receiver has been created and opened. */ public rx.Single rxCreateDynamicReceiver() { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { this.createDynamicReceiver().onComplete(fut); })); } /** * Creates a sender used to send messages to the given address. The address must be set. For anonymous sender, check * {@link io.vertx.rxjava.amqp.AmqpConnection#createAnonymousSender}. * @param address The target address to attach to, must not be null * @return a future notified with the sender, once opened */ public io.vertx.core.Future createSender(java.lang.String address) { io.vertx.core.Future ret = delegate.createSender(address).map(val -> io.vertx.rxjava.amqp.AmqpSender.newInstance((io.vertx.amqp.AmqpSender)val)); return ret; } /** * Creates a sender used to send messages to the given address. The address must be set. For anonymous sender, check * {@link io.vertx.rxjava.amqp.AmqpConnection#createAnonymousSender}. * @param address The target address to attach to, must not be null * @return a future notified with the sender, once opened */ public rx.Single rxCreateSender(java.lang.String address) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { this.createSender(address).onComplete(fut); })); } /** * Creates a sender used to send messages to the given address. The address must be set. For anonymous sender, check * {@link io.vertx.rxjava.amqp.AmqpConnection#createAnonymousSender}. * @param address The target address to attach to, allowed to be null if the options configures the sender to be attached to a dynamic address (provided by the broker). * @param options The AMQP sender options * @return a future notified with the sender, once opened */ public io.vertx.core.Future createSender(java.lang.String address, io.vertx.amqp.AmqpSenderOptions options) { io.vertx.core.Future ret = delegate.createSender(address, options).map(val -> io.vertx.rxjava.amqp.AmqpSender.newInstance((io.vertx.amqp.AmqpSender)val)); return ret; } /** * Creates a sender used to send messages to the given address. The address must be set. For anonymous sender, check * {@link io.vertx.rxjava.amqp.AmqpConnection#createAnonymousSender}. * @param address The target address to attach to, allowed to be null if the options configures the sender to be attached to a dynamic address (provided by the broker). * @param options The AMQP sender options * @return a future notified with the sender, once opened */ public rx.Single rxCreateSender(java.lang.String address, io.vertx.amqp.AmqpSenderOptions options) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { this.createSender(address, options).onComplete(fut); })); } /** * Creates an anonymous sender. *

* Unlike "regular" sender, this sender is not associated to a specific address, and each message sent must provide * an address. This method can be used in request-reply scenarios where you create a sender to send the reply, * but you don't know the address, as the reply address is passed into the message you are going to receive. * @return a future notifid with the created sender, once opened */ public io.vertx.core.Future createAnonymousSender() { io.vertx.core.Future ret = delegate.createAnonymousSender().map(val -> io.vertx.rxjava.amqp.AmqpSender.newInstance((io.vertx.amqp.AmqpSender)val)); return ret; } /** * Creates an anonymous sender. *

* Unlike "regular" sender, this sender is not associated to a specific address, and each message sent must provide * an address. This method can be used in request-reply scenarios where you create a sender to send the reply, * but you don't know the address, as the reply address is passed into the message you are going to receive. * @return a future notifid with the created sender, once opened */ public rx.Single rxCreateAnonymousSender() { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { this.createAnonymousSender().onComplete(fut); })); } /** * @return whether the connection has been disconnected. */ public boolean isDisconnected() { boolean ret = delegate.isDisconnected(); return ret; } /** * @return a future completed when the connection is closed */ public io.vertx.core.Future closeFuture() { io.vertx.core.Future ret = delegate.closeFuture().map(val -> val); return ret; } /** * @return a future completed when the connection is closed */ public rx.Single rxCloseFuture() { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { this.closeFuture().onComplete(fut); })); } /** * @return the underlying ProtonConnection. */ public io.vertx.proton.ProtonConnection unwrap() { io.vertx.proton.ProtonConnection ret = delegate.unwrap(); return ret; } public static AmqpConnection newInstance(io.vertx.amqp.AmqpConnection arg) { return arg != null ? new AmqpConnection(arg) : null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy