/*
* 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.ext.stomp;
import java.util.Map;
import rx.Observable;
import rx.Single;
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.rxjava.ext.stomp.StompClient} using the default implementation.
* @param vertx the vert.x instance to use
* @return the created {@link io.vertx.rxjava.ext.stomp.StompClient}
*/
public static io.vertx.rxjava.ext.stomp.StompClient create(io.vertx.rxjava.core.Vertx vertx) {
io.vertx.rxjava.ext.stomp.StompClient ret = io.vertx.rxjava.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.rxjava.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.rxjava.ext.stomp.StompClient}
*/
public static io.vertx.rxjava.ext.stomp.StompClient create(io.vertx.rxjava.core.Vertx vertx, StompClientOptions options) {
io.vertx.rxjava.ext.stomp.StompClient ret = io.vertx.rxjava.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.rxjava.ext.stomp.StompClient}
*/
public io.vertx.rxjava.ext.stomp.StompClient connect(int port, String host, Handler<AsyncResult<io.vertx.rxjava.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.rxjava.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
Deprecated: use rxConnect
instead
/**
* Connects to the server.
* @param port the server port
* @param host the server host
* @return the current {@link io.vertx.rxjava.ext.stomp.StompClient}
* @deprecated use {@link #rxConnect} instead
*/
@Deprecated()
public Observable<io.vertx.rxjava.ext.stomp.StompClientConnection> connectObservable(int port, String host) {
io.vertx.rx.java.ObservableFuture<io.vertx.rxjava.ext.stomp.StompClientConnection> resultHandler = io.vertx.rx.java.RxHelper.observableFuture();
connect(port, host, resultHandler.toHandler());
return resultHandler;
}
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.rxjava.ext.stomp.StompClient}
*/
public Single<io.vertx.rxjava.ext.stomp.StompClientConnection> rxConnect(int port, String host) {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
connect(port, host, fut);
}));
}
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.rxjava.ext.stomp.StompClient}
*/
public io.vertx.rxjava.ext.stomp.StompClient connect(io.vertx.rxjava.core.net.NetClient net, Handler<AsyncResult<io.vertx.rxjava.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.rxjava.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
Deprecated: use rxConnect
instead
/**
* Connects to the server.
* @param net the NET client to use
* @return the current {@link io.vertx.rxjava.ext.stomp.StompClient}
* @deprecated use {@link #rxConnect} instead
*/
@Deprecated()
public Observable<io.vertx.rxjava.ext.stomp.StompClientConnection> connectObservable(io.vertx.rxjava.core.net.NetClient net) {
io.vertx.rx.java.ObservableFuture<io.vertx.rxjava.ext.stomp.StompClientConnection> resultHandler = io.vertx.rx.java.RxHelper.observableFuture();
connect(net, resultHandler.toHandler());
return resultHandler;
}
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.rxjava.ext.stomp.StompClient}
*/
public Single<io.vertx.rxjava.ext.stomp.StompClientConnection> rxConnect(io.vertx.rxjava.core.net.NetClient net) {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
connect(net, fut);
}));
}
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.rxjava.ext.stomp.StompClient}
*/
public io.vertx.rxjava.ext.stomp.StompClient connect(int port, String host, io.vertx.rxjava.core.net.NetClient net, Handler<AsyncResult<io.vertx.rxjava.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.rxjava.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
Deprecated: use rxConnect
instead
/**
* 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.rxjava.ext.stomp.StompClient}
* @deprecated use {@link #rxConnect} instead
*/
@Deprecated()
public Observable<io.vertx.rxjava.ext.stomp.StompClientConnection> connectObservable(int port, String host, io.vertx.rxjava.core.net.NetClient net) {
io.vertx.rx.java.ObservableFuture<io.vertx.rxjava.ext.stomp.StompClientConnection> resultHandler = io.vertx.rx.java.RxHelper.observableFuture();
connect(port, host, net, resultHandler.toHandler());
return resultHandler;
}
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.rxjava.ext.stomp.StompClient}
*/
public Single<io.vertx.rxjava.ext.stomp.StompClientConnection> rxConnect(int port, String host, io.vertx.rxjava.core.net.NetClient net) {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
connect(port, host, net, fut);
}));
}
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.rxjava.ext.stomp.StompClient#exceptionHandler} is called.
* @return the current {@link io.vertx.rxjava.ext.stomp.StompClient}
*/
public io.vertx.rxjava.ext.stomp.StompClient connect(Handler<AsyncResult<io.vertx.rxjava.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.rxjava.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
Deprecated: use rxConnect
instead
/**
* Connects to the server using the host and port configured in the client's options.
* @return the current {@link io.vertx.rxjava.ext.stomp.StompClient}
* @deprecated use {@link #rxConnect} instead
*/
@Deprecated()
public Observable<io.vertx.rxjava.ext.stomp.StompClientConnection> connectObservable() {
io.vertx.rx.java.ObservableFuture<io.vertx.rxjava.ext.stomp.StompClientConnection> resultHandler = io.vertx.rx.java.RxHelper.observableFuture();
connect(resultHandler.toHandler());
return resultHandler;
}
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.rxjava.ext.stomp.StompClient}
*/
public Single<io.vertx.rxjava.ext.stomp.StompClientConnection> rxConnect() {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
connect(fut);
}));
}
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.rxjava.ext.stomp.StompClientConnection#receivedFrameHandler}.
* @param handler the handler
* @return the current {@link io.vertx.rxjava.ext.stomp.StompClient}
*/
public io.vertx.rxjava.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.rxjava.ext.stomp.StompClientConnection#writingFrameHandler}.
* @param handler the handler
* @return the current {@link io.vertx.rxjava.ext.stomp.StompClient}
*/
public io.vertx.rxjava.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.rxjava.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.rxjava.ext.stomp.StompClient}
*/
public io.vertx.rxjava.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.rxjava.ext.stomp.StompClient}
*/
public io.vertx.rxjava.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.rxjava.core.Vertx vertx() {
io.vertx.rxjava.core.Vertx ret = io.vertx.rxjava.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;
}
}