/*
 * 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.reactivex.ext.stomp;

import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.vertx.ext.stomp.Frame;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.ext.stomp.StompClientOptions;

Defines a STOMP client.

NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.
/** * Defines a STOMP client. * * <p/> * NOTE: This class has been automatically generated from the {@link io.vertx.ext.stomp.StompClient original} non RX-ified interface using Vert.x codegen. */
@io.vertx.lang.rx.RxGen(io.vertx.ext.stomp.StompClient.class) public class StompClient { @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; StompClient that = (StompClient) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final io.vertx.lang.rx.TypeArg<StompClient> __TYPE_ARG = new io.vertx.lang.rx.TypeArg<>( obj -> new StompClient((io.vertx.ext.stomp.StompClient) obj), StompClient::getDelegate ); private final io.vertx.ext.stomp.StompClient delegate; public StompClient(io.vertx.ext.stomp.StompClient delegate) { this.delegate = delegate; } public io.vertx.ext.stomp.StompClient getDelegate() { return delegate; }
Creates a StompClient using the default implementation.
Params:
  • vertx – the vert.x instance to use
Returns:the created StompClient
/** * Creates a {@link io.vertx.reactivex.ext.stomp.StompClient} using the default implementation. * @param vertx the vert.x instance to use * @return the created {@link io.vertx.reactivex.ext.stomp.StompClient} */
public static io.vertx.reactivex.ext.stomp.StompClient create(io.vertx.reactivex.core.Vertx vertx) { io.vertx.reactivex.ext.stomp.StompClient ret = io.vertx.reactivex.ext.stomp.StompClient.newInstance(io.vertx.ext.stomp.StompClient.create(vertx.getDelegate())); return ret; }
Creates a StompClient using the default implementation.
Params:
  • vertx – the vert.x instance to use
  • options – the options
Returns:the created StompClient
/** * Creates a {@link io.vertx.reactivex.ext.stomp.StompClient} using the default implementation. * @param vertx the vert.x instance to use * @param options the options * @return the created {@link io.vertx.reactivex.ext.stomp.StompClient} */
public static io.vertx.reactivex.ext.stomp.StompClient create(io.vertx.reactivex.core.Vertx vertx, StompClientOptions options) { io.vertx.reactivex.ext.stomp.StompClient ret = io.vertx.reactivex.ext.stomp.StompClient.newInstance(io.vertx.ext.stomp.StompClient.create(vertx.getDelegate(), options)); return ret; }
Connects to the server.
Params:
  • port – the server port
  • host – the server host
  • resultHandler – handler called with the connection result
Returns:the current StompClient
/** * Connects to the server. * @param port the server port * @param host the server host * @param resultHandler handler called with the connection result * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public io.vertx.reactivex.ext.stomp.StompClient connect(int port, String host, Handler<AsyncResult<io.vertx.reactivex.ext.stomp.StompClientConnection>> resultHandler) { delegate.connect(port, host, new Handler<AsyncResult<io.vertx.ext.stomp.StompClientConnection>>() { public void handle(AsyncResult<io.vertx.ext.stomp.StompClientConnection> ar) { if (ar.succeeded()) { resultHandler.handle(io.vertx.core.Future.succeededFuture(io.vertx.reactivex.ext.stomp.StompClientConnection.newInstance(ar.result()))); } else { resultHandler.handle(io.vertx.core.Future.failedFuture(ar.cause())); } } }); return this; }
Connects to the server.
Params:
  • port – the server port
  • host – the server host
Returns:the current StompClient
/** * Connects to the server. * @param port the server port * @param host the server host * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public Single<io.vertx.reactivex.ext.stomp.StompClientConnection> rxConnect(int port, String host) { return io.vertx.reactivex.impl.AsyncResultSingle.toSingle(handler -> { connect(port, host, handler); }); }
Connects to the server.
Params:
  • net – the NET client to use
  • resultHandler – handler called with the connection result
Returns:the current StompClient
/** * Connects to the server. * @param net the NET client to use * @param resultHandler handler called with the connection result * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public io.vertx.reactivex.ext.stomp.StompClient connect(io.vertx.reactivex.core.net.NetClient net, Handler<AsyncResult<io.vertx.reactivex.ext.stomp.StompClientConnection>> resultHandler) { delegate.connect(net.getDelegate(), new Handler<AsyncResult<io.vertx.ext.stomp.StompClientConnection>>() { public void handle(AsyncResult<io.vertx.ext.stomp.StompClientConnection> ar) { if (ar.succeeded()) { resultHandler.handle(io.vertx.core.Future.succeededFuture(io.vertx.reactivex.ext.stomp.StompClientConnection.newInstance(ar.result()))); } else { resultHandler.handle(io.vertx.core.Future.failedFuture(ar.cause())); } } }); return this; }
Connects to the server.
Params:
  • net – the NET client to use
Returns:the current StompClient
/** * Connects to the server. * @param net the NET client to use * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public Single<io.vertx.reactivex.ext.stomp.StompClientConnection> rxConnect(io.vertx.reactivex.core.net.NetClient net) { return io.vertx.reactivex.impl.AsyncResultSingle.toSingle(handler -> { connect(net, handler); }); }
Connects to the server.
Params:
  • port – the server port
  • host – the server host
  • net – the NET client to use
  • resultHandler – handler called with the connection result
Returns:the current StompClient
/** * Connects to the server. * @param port the server port * @param host the server host * @param net the NET client to use * @param resultHandler handler called with the connection result * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public io.vertx.reactivex.ext.stomp.StompClient connect(int port, String host, io.vertx.reactivex.core.net.NetClient net, Handler<AsyncResult<io.vertx.reactivex.ext.stomp.StompClientConnection>> resultHandler) { delegate.connect(port, host, net.getDelegate(), new Handler<AsyncResult<io.vertx.ext.stomp.StompClientConnection>>() { public void handle(AsyncResult<io.vertx.ext.stomp.StompClientConnection> ar) { if (ar.succeeded()) { resultHandler.handle(io.vertx.core.Future.succeededFuture(io.vertx.reactivex.ext.stomp.StompClientConnection.newInstance(ar.result()))); } else { resultHandler.handle(io.vertx.core.Future.failedFuture(ar.cause())); } } }); return this; }
Connects to the server.
Params:
  • port – the server port
  • host – the server host
  • net – the NET client to use
Returns:the current StompClient
/** * Connects to the server. * @param port the server port * @param host the server host * @param net the NET client to use * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public Single<io.vertx.reactivex.ext.stomp.StompClientConnection> rxConnect(int port, String host, io.vertx.reactivex.core.net.NetClient net) { return io.vertx.reactivex.impl.AsyncResultSingle.toSingle(handler -> { connect(port, host, net, handler); }); }
Connects to the server using the host and port configured in the client's options.
Params:
  • resultHandler – handler called with the connection result. A failure will be sent to the handler if a TCP level issue happen before the `CONNECTED` frame is received. Afterwards, the exceptionHandler is called.
Returns:the current StompClient
/** * Connects to the server using the host and port configured in the client's options. * @param resultHandler handler called with the connection result. A failure will be sent to the handler if a TCP level issue happen before the `CONNECTED` frame is received. Afterwards, the {@link io.vertx.reactivex.ext.stomp.StompClient#exceptionHandler} is called. * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public io.vertx.reactivex.ext.stomp.StompClient connect(Handler<AsyncResult<io.vertx.reactivex.ext.stomp.StompClientConnection>> resultHandler) { delegate.connect(new Handler<AsyncResult<io.vertx.ext.stomp.StompClientConnection>>() { public void handle(AsyncResult<io.vertx.ext.stomp.StompClientConnection> ar) { if (ar.succeeded()) { resultHandler.handle(io.vertx.core.Future.succeededFuture(io.vertx.reactivex.ext.stomp.StompClientConnection.newInstance(ar.result()))); } else { resultHandler.handle(io.vertx.core.Future.failedFuture(ar.cause())); } } }); return this; }
Connects to the server using the host and port configured in the client's options.
Returns:the current StompClient
/** * Connects to the server using the host and port configured in the client's options. * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public Single<io.vertx.reactivex.ext.stomp.StompClientConnection> rxConnect() { return io.vertx.reactivex.impl.AsyncResultSingle.toSingle(handler -> { connect(handler); }); }
Configures a received handler that gets notified when a STOMP frame is received by the client. This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified at the time.

When a connection is created, the handler is used as StompClientConnection.receivedFrameHandler.

Params:
  • handler – the handler
Returns:the current StompClient
/** * Configures a received handler that gets notified when a STOMP frame is received by the client. * This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified at the time. * <p> * When a connection is created, the handler is used as * {@link io.vertx.reactivex.ext.stomp.StompClientConnection#receivedFrameHandler}. * @param handler the handler * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public io.vertx.reactivex.ext.stomp.StompClient receivedFrameHandler(Handler<Frame> handler) { delegate.receivedFrameHandler(handler); return this; }
Configures a writing handler that gets notified when a STOMP frame is written on the wire. This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified at the time.

When a connection is created, the handler is used as StompClientConnection.writingFrameHandler.

Params:
  • handler – the handler
Returns:the current StompClient
/** * Configures a writing handler that gets notified when a STOMP frame is written on the wire. * This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified at the time. * <p> * When a connection is created, the handler is used as * {@link io.vertx.reactivex.ext.stomp.StompClientConnection#writingFrameHandler}. * @param handler the handler * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public io.vertx.reactivex.ext.stomp.StompClient writingFrameHandler(Handler<Frame> handler) { delegate.writingFrameHandler(handler); return this; }
A general error frame handler. It can be used to catch ERROR frame emitted during the connection process (wrong authentication). This error handler will be pass to all StompClientConnection created from this client. Obviously, the client can override it when the connection is established.
Params:
  • handler – the handler
Returns:the current StompClient
/** * A general error frame handler. It can be used to catch <code>ERROR</code> frame emitted during the connection process * (wrong authentication). This error handler will be pass to all {@link io.vertx.reactivex.ext.stomp.StompClientConnection} created from this * client. Obviously, the client can override it when the connection is established. * @param handler the handler * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public io.vertx.reactivex.ext.stomp.StompClient errorFrameHandler(Handler<Frame> handler) { delegate.errorFrameHandler(handler); return this; }
Sets an exception handler notified for TCP-level errors.
Params:
  • handler – the handler
Returns:the current StompClient
/** * Sets an exception handler notified for TCP-level errors. * @param handler the handler * @return the current {@link io.vertx.reactivex.ext.stomp.StompClient} */
public io.vertx.reactivex.ext.stomp.StompClient exceptionHandler(Handler<Throwable> handler) { delegate.exceptionHandler(handler); return this; }
Closes the client.
/** * Closes the client. */
public void close() { delegate.close(); }
Returns:the client's options.
/** * @return the client's options. */
public StompClientOptions options() { StompClientOptions ret = delegate.options(); return ret; }
Returns:the vert.x instance used by the client.
/** * @return the vert.x instance used by the client. */
public io.vertx.reactivex.core.Vertx vertx() { io.vertx.reactivex.core.Vertx ret = io.vertx.reactivex.core.Vertx.newInstance(delegate.vertx()); return ret; }
Returns:whether or not the client is connected to the server.
/** * @return whether or not the client is connected to the server. */
public boolean isClosed() { boolean ret = delegate.isClosed(); return ret; } public static StompClient newInstance(io.vertx.ext.stomp.StompClient arg) { return arg != null ? new StompClient(arg) : null; } }