io.vertx.rxjava.ext.stomp.Destination 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;
/**
 * Represents a STOMP destination.
 * Depending on the implementation, the message delivery is different. Queue are sending message to only one
 * subscribers, while topics are broadcasting the message to all subscribers.
 * 
 * Implementations must be thread-safe.
 *
 * 
 * NOTE: This class has been automatically generated from the {@link io.vertx.ext.stomp.Destination original} non RX-ified interface using Vert.x codegen.
 */
@RxGen(io.vertx.ext.stomp.Destination.class)
public class Destination {
  @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;
    Destination that = (Destination) o;
    return delegate.equals(that.delegate);
  }
  
  @Override
  public int hashCode() {
    return delegate.hashCode();
  }
  public static final TypeArg __TYPE_ARG = new TypeArg<>(    obj -> new Destination((io.vertx.ext.stomp.Destination) obj),
    Destination::getDelegate
  );
  private final io.vertx.ext.stomp.Destination delegate;
  
  public Destination(io.vertx.ext.stomp.Destination delegate) {
    this.delegate = delegate;
  }
  public Destination(Object delegate) {
    this.delegate = (io.vertx.ext.stomp.Destination)delegate;
  }
  public io.vertx.ext.stomp.Destination getDelegate() {
    return delegate;
  }
  public static io.vertx.rxjava.ext.stomp.Destination topic(io.vertx.rxjava.core.Vertx vertx, java.lang.String destination) { 
    io.vertx.rxjava.ext.stomp.Destination ret = io.vertx.rxjava.ext.stomp.Destination.newInstance((io.vertx.ext.stomp.Destination)io.vertx.ext.stomp.Destination.topic(vertx.getDelegate(), destination));
    return ret;
  }
  public static io.vertx.rxjava.ext.stomp.Destination queue(io.vertx.rxjava.core.Vertx vertx, java.lang.String destination) { 
    io.vertx.rxjava.ext.stomp.Destination ret = io.vertx.rxjava.ext.stomp.Destination.newInstance((io.vertx.ext.stomp.Destination)io.vertx.ext.stomp.Destination.queue(vertx.getDelegate(), destination));
    return ret;
  }
  public static io.vertx.rxjava.ext.stomp.Destination bridge(io.vertx.rxjava.core.Vertx vertx, io.vertx.ext.stomp.BridgeOptions options) { 
    io.vertx.rxjava.ext.stomp.Destination ret = io.vertx.rxjava.ext.stomp.Destination.newInstance((io.vertx.ext.stomp.Destination)io.vertx.ext.stomp.Destination.bridge(vertx.getDelegate(), options));
    return ret;
  }
  /**
   * @return the destination address.
   */
  public java.lang.String destination() { 
    java.lang.String ret = delegate.destination();
    return ret;
  }
  /**
   * Dispatches the given frame.
   * @param connection the connection
   * @param frame the frame
   * @return the current instance of {@link io.vertx.rxjava.ext.stomp.Destination}
   */
  public io.vertx.rxjava.ext.stomp.Destination dispatch(io.vertx.rxjava.ext.stomp.StompServerConnection connection, io.vertx.ext.stomp.Frame frame) { 
    delegate.dispatch(connection.getDelegate(), frame);
    return this;
  }
  /**
   * Handles a subscription request to the current {@link io.vertx.rxjava.ext.stomp.Destination}.
   * @param connection the connection
   * @param frame the SUBSCRIBE frame
   * @return the current instance of {@link io.vertx.rxjava.ext.stomp.Destination}
   */
  public io.vertx.rxjava.ext.stomp.Destination subscribe(io.vertx.rxjava.ext.stomp.StompServerConnection connection, io.vertx.ext.stomp.Frame frame) { 
    delegate.subscribe(connection.getDelegate(), frame);
    return this;
  }
  /**
   * Handles a un-subscription request to the current {@link io.vertx.rxjava.ext.stomp.Destination}.
   * @param connection the connection
   * @param frame the UNSUBSCRIBE frame
   * @return true if the un-subscription has been handled, false otherwise.
   */
  public boolean unsubscribe(io.vertx.rxjava.ext.stomp.StompServerConnection connection, io.vertx.ext.stomp.Frame frame) { 
    boolean ret = delegate.unsubscribe(connection.getDelegate(), frame);
    return ret;
  }
  /**
   * Removes all subscriptions of the given connection
   * @param connection the connection
   * @return the current instance of {@link io.vertx.rxjava.ext.stomp.Destination}
   */
  public io.vertx.rxjava.ext.stomp.Destination unsubscribeConnection(io.vertx.rxjava.ext.stomp.StompServerConnection connection) { 
    delegate.unsubscribeConnection(connection.getDelegate());
    return this;
  }
  /**
   * Handles a ACK frame.
   * @param connection the connection
   * @param frame the ACK frame
   * @return true if the destination has handled the frame (meaning it has sent the message with id)
   */
  public boolean ack(io.vertx.rxjava.ext.stomp.StompServerConnection connection, io.vertx.ext.stomp.Frame frame) { 
    boolean ret = delegate.ack(connection.getDelegate(), frame);
    return ret;
  }
  /**
   * Handles a NACK frame.
   * @param connection the connection
   * @param frame the NACK frame
   * @return true if the destination has handled the frame (meaning it has sent the message with id)
   */
  public boolean nack(io.vertx.rxjava.ext.stomp.StompServerConnection connection, io.vertx.ext.stomp.Frame frame) { 
    boolean ret = delegate.nack(connection.getDelegate(), frame);
    return ret;
  }
  /**
   * Gets all subscription ids for the given destination hold by the given client
   * @param connection the connection (client)
   * @return the list of subscription id, empty if none
   */
  public java.util.List getSubscriptions(io.vertx.rxjava.ext.stomp.StompServerConnection connection) { 
    java.util.List ret = delegate.getSubscriptions(connection.getDelegate());
    return ret;
  }
  /**
   * Gets the number of subscriptions attached to the current {@link io.vertx.rxjava.ext.stomp.Destination}.
   * @return the number of subscriptions.
   */
  public int numberOfSubscriptions() { 
    int ret = delegate.numberOfSubscriptions();
    return ret;
  }
  /**
   * Checks whether or not the given address matches with the current destination.
   * @param address the address
   * @return true if it matches, false otherwise.
   */
  public boolean matches(java.lang.String address) { 
    boolean ret = delegate.matches(address);
    return ret;
  }
  public static Destination newInstance(io.vertx.ext.stomp.Destination arg) {
    return arg != null ? new Destination(arg) : null;
  }
}
       © 2015 - 2025 Weber Informatics LLC | Privacy Policy