io.vertx.rxjava.ext.stomp.StompServerConnection Maven / Gradle / Ivy
/*
 * 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 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.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;
/**
 * Class representing a connection between a STOMP client a the server. It keeps a references on the client socket,
 * so let write to this socket.
 *
 * 
 * NOTE: This class has been automatically generated from the {@link io.vertx.ext.stomp.StompServerConnection original} non RX-ified interface using Vert.x codegen.
 */
@RxGen(io.vertx.ext.stomp.StompServerConnection.class)
public class StompServerConnection {
  @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;
    StompServerConnection that = (StompServerConnection) o;
    return delegate.equals(that.delegate);
  }
  
  @Override
  public int hashCode() {
    return delegate.hashCode();
  }
  public static final TypeArg __TYPE_ARG = new TypeArg<>(    obj -> new StompServerConnection((io.vertx.ext.stomp.StompServerConnection) obj),
    StompServerConnection::getDelegate
  );
  private final io.vertx.ext.stomp.StompServerConnection delegate;
  
  public StompServerConnection(io.vertx.ext.stomp.StompServerConnection delegate) {
    this.delegate = delegate;
  }
  public StompServerConnection(Object delegate) {
    this.delegate = (io.vertx.ext.stomp.StompServerConnection)delegate;
  }
  public io.vertx.ext.stomp.StompServerConnection getDelegate() {
    return delegate;
  }
  /**
   * Writes the given frame to the socket.
   * @param frame the frame, must not be null.
   * @return the current {@link io.vertx.rxjava.ext.stomp.StompServerConnection}
   */
  public io.vertx.rxjava.ext.stomp.StompServerConnection write(io.vertx.ext.stomp.Frame frame) { 
    delegate.write(frame);
    return this;
  }
  /**
   * Writes the given buffer to the socket. This is a low level API that should be used carefully.
   * @param buffer the buffer
   * @return the current {@link io.vertx.rxjava.ext.stomp.StompServerConnection}
   */
  public io.vertx.rxjava.ext.stomp.StompServerConnection write(io.vertx.rxjava.core.buffer.Buffer buffer) { 
    delegate.write(buffer.getDelegate());
    return this;
  }
  /**
   * @return the STOMP server serving this connection.
   */
  public io.vertx.rxjava.ext.stomp.StompServer server() { 
    io.vertx.rxjava.ext.stomp.StompServer ret = io.vertx.rxjava.ext.stomp.StompServer.newInstance((io.vertx.ext.stomp.StompServer)delegate.server());
    return ret;
  }
  /**
   * @return the STOMP server handler dealing with this connection
   */
  public io.vertx.rxjava.ext.stomp.StompServerHandler handler() { 
    io.vertx.rxjava.ext.stomp.StompServerHandler ret = io.vertx.rxjava.ext.stomp.StompServerHandler.newInstance((io.vertx.ext.stomp.StompServerHandler)delegate.handler());
    return ret;
  }
  /**
   * @return the STOMP session id computed when the client has established the connection to the server
   */
  public java.lang.String session() { 
    java.lang.String ret = delegate.session();
    return ret;
  }
  /**
   * Closes the connection with the client.
   */
  public void close() { 
    delegate.close();
  }
  /**
   * Sends a `PING` frame to the client. A `PING` frame is a frame containing only EOL.
   */
  public void ping() { 
    delegate.ping();
  }
  /**
   * Notifies the connection about server activity (the server has sent a frame). This method is used to handle the
   * heartbeat.
   */
  public void onServerActivity() { 
    delegate.onServerActivity();
  }
  /**
   * Configures the heartbeat.
   * @param ping ping time
   * @param pong pong time
   * @param pingHandler the ping handler
   */
  public void configureHeartbeat(long ping, long pong, io.vertx.core.Handler pingHandler) { 
    delegate.configureHeartbeat(ping, pong, new Handler() {
      public void handle(io.vertx.ext.stomp.StompServerConnection event) {
        pingHandler.handle(io.vertx.rxjava.ext.stomp.StompServerConnection.newInstance((io.vertx.ext.stomp.StompServerConnection)event));
      }
    });
  }
  /**
   * @return SSLSession associated with the underlying socket. Returns null if connection is not SSL.
   */
  public javax.net.ssl.SSLSession sslSession() { 
    javax.net.ssl.SSLSession ret = delegate.sslSession();
    return ret;
  }
  public static StompServerConnection newInstance(io.vertx.ext.stomp.StompServerConnection arg) {
    return arg != null ? new StompServerConnection(arg) : null;
  }
}
       © 2015 - 2025 Weber Informatics LLC | Privacy Policy