Class WampPublisher

java.lang.Object
ch.rasc.wamp2spring.WampPublisher

public class WampPublisher extends Object
A publisher that allows the calling code to send PublishMessages to the Broker. The WampPublisher is by default configured as a Spring managed bean and can be autowired into any other spring bean. e.g.
 @Service
 public class MyService {
        private final WampPublisher wampPublisher;

        public MyService(WampPublisher wampPublisher) {
                this.wampPublisher = wampPublisher;
        }
 }
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    WampPublisher(org.springframework.messaging.MessageChannel clientInboundChannel)
    Creates a new WAMP publisher that sends events over the provided channel
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    publish(PublishMessage publishMessage)
    Sends an arbitrary PublishMessage to the Broker.
    Creates a new builder for a PublishMessage
    <T> void
    publishTo(long eligibleWampSessionId, String topic, Collection<T> arguments)
    Creates a new event and sends it to a one specific Subscriber of the topic
    <T> void
    publishTo(long eligibleWampSessionId, String topic, Map<String,T> arguments)
    Creates a new event and sends it to a one specific Subscriber of the topic
    <T> void
    publishTo(long eligibleWampSessionId, String topic, T... arguments)
    Creates a new event and sends it to a one specific Subscriber of the topic
    <T> void
    publishTo(Collection<Long> eligibleWampSessionIds, String topic, Collection<T> arguments)
    Creates a new event and sends it to a specific group of Subscribers of the topic
    <T> void
    publishTo(Collection<Long> eligibleWampSessionIds, String topic, Map<String,T> arguments)
    Creates a new event and sends it to a specific group of Subscribers of the topic
    <T> void
    publishTo(Collection<Long> eligibleWampSessionIds, String topic, T... arguments)
    Creates a new event and sends it to a specific group of Subscribers of the topic
    <T> void
    publishToAll(String topic, Collection<T> arguments)
    Creates a new event and sends it to all Subscribers of the topic
    <T> void
    publishToAll(String topic, Map<String,T> arguments)
    Creates a new event and sends it to all Subscribers of the topic
    <T> void
    publishToAll(String topic, T... arguments)
    Creates a new event and sends it to all Subscribers of the topic
    <T> void
    publishToAllExcept(long excludeWampSessionId, String topic, Collection<T> arguments)
    Creates a new event and sends it to all Subscribers of the topic except to the Subscriber with the provided WAMP session id
    <T> void
    publishToAllExcept(long excludeWampSessionId, String topic, Map<String,T> arguments)
    Creates a new event and sends it to all Subscribers of the topic except to the Subscriber with the provided WAMP session id
    <T> void
    publishToAllExcept(long excludeWampSessionId, String topic, T... arguments)
    Creates a new event and sends it to all Subscribers of the topic except to the Subscriber with the provided WAMP session id
    <T> void
    publishToAllExcept(Collection<Long> excludeWampSessionIds, String topic, Collection<T> arguments)
    Creates a new event and sends it to all Subscribers of the topic except to Subscribers that are listed in the provided collection of WAMP session ids
    <T> void
    publishToAllExcept(Collection<Long> excludeWampSessionIds, String topic, Map<String,T> arguments)
    Creates a new event and sends it to all Subscribers of the topic except to Subscribers that are listed in the provided collection of WAMP session ids
    <T> void
    publishToAllExcept(Collection<Long> excludeWampSessionIds, String topic, T... arguments)
    Creates a new event and sends it to all Subscribers of the topic except to Subscribers that are listed in the provided collection of WAMP session ids

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WampPublisher

      public WampPublisher(org.springframework.messaging.MessageChannel clientInboundChannel)
      Creates a new WAMP publisher that sends events over the provided channel
  • Method Details

    • publish

      public void publish(PublishMessage publishMessage)
      Sends an arbitrary PublishMessage to the Broker.
      Parameters:
      publishMessage - the PublishMessage instance
    • publishToAll

      public <T> void publishToAll(String topic, @Nullable T... arguments)
      Creates a new event and sends it to all Subscribers of the topic
      Parameters:
      topic - the topic to send the event to
      arguments - a variable number of event arguments
    • publishToAll

      public <T> void publishToAll(String topic, @Nullable Collection<T> arguments)
      Creates a new event and sends it to all Subscribers of the topic
      Parameters:
      topic - the topic to send the event to
      arguments - a collection of event arguments
    • publishToAll

      public <T> void publishToAll(String topic, @Nullable Map<String,T> arguments)
      Creates a new event and sends it to all Subscribers of the topic
      Parameters:
      topic - the topic to send the event to
      arguments - a map with event arguments
    • publishTo

      public <T> void publishTo(Collection<Long> eligibleWampSessionIds, String topic, @Nullable T... arguments)
      Creates a new event and sends it to a specific group of Subscribers of the topic
      Parameters:
      eligibleWampSessionIds - the collection of WAMP session ids to send the event to
      topic - the topic to send the event to
      arguments - a variable number of event arguments
    • publishTo

      public <T> void publishTo(Collection<Long> eligibleWampSessionIds, String topic, @Nullable Collection<T> arguments)
      Creates a new event and sends it to a specific group of Subscribers of the topic
      Parameters:
      eligibleWampSessionIds -
      topic - the topic to send the event to
      arguments - a collection of event arguments
    • publishTo

      public <T> void publishTo(Collection<Long> eligibleWampSessionIds, String topic, @Nullable Map<String,T> arguments)
      Creates a new event and sends it to a specific group of Subscribers of the topic
      Parameters:
      eligibleWampSessionIds -
      topic - the topic to send the event to
      arguments - a map with event arguments
    • publishTo

      public <T> void publishTo(long eligibleWampSessionId, String topic, @Nullable T... arguments)
      Creates a new event and sends it to a one specific Subscriber of the topic
      Parameters:
      eligibleWampSessionId -
      topic - the topic to send the event to
      arguments - a variable number of event arguments
    • publishTo

      public <T> void publishTo(long eligibleWampSessionId, String topic, @Nullable Collection<T> arguments)
      Creates a new event and sends it to a one specific Subscriber of the topic
      Parameters:
      eligibleWampSessionId -
      topic - the topic to send the event to
      arguments - a collection of event arguments
    • publishTo

      public <T> void publishTo(long eligibleWampSessionId, String topic, @Nullable Map<String,T> arguments)
      Creates a new event and sends it to a one specific Subscriber of the topic
      Parameters:
      eligibleWampSessionId -
      topic - the topic to send the event to
      arguments - a map with event arguments
    • publishToAllExcept

      public <T> void publishToAllExcept(Collection<Long> excludeWampSessionIds, String topic, @Nullable T... arguments)
      Creates a new event and sends it to all Subscribers of the topic except to Subscribers that are listed in the provided collection of WAMP session ids
      Parameters:
      excludeWampSessionIds -
      topic - the topic to send the event to
      arguments - a variable number of event arguments
    • publishToAllExcept

      public <T> void publishToAllExcept(Collection<Long> excludeWampSessionIds, String topic, @Nullable Collection<T> arguments)
      Creates a new event and sends it to all Subscribers of the topic except to Subscribers that are listed in the provided collection of WAMP session ids
      Parameters:
      excludeWampSessionIds -
      topic - the topic to send the event to
      arguments - a collection of event arguments
    • publishToAllExcept

      public <T> void publishToAllExcept(Collection<Long> excludeWampSessionIds, String topic, @Nullable Map<String,T> arguments)
      Creates a new event and sends it to all Subscribers of the topic except to Subscribers that are listed in the provided collection of WAMP session ids
      Parameters:
      excludeWampSessionIds -
      topic - the topic to send the event to
      arguments - a map with event arguments
    • publishToAllExcept

      public <T> void publishToAllExcept(long excludeWampSessionId, String topic, @Nullable T... arguments)
      Creates a new event and sends it to all Subscribers of the topic except to the Subscriber with the provided WAMP session id
      Parameters:
      excludeWampSessionId -
      topic - the topic to send the event to
      arguments - a variable number of event arguments
    • publishToAllExcept

      public <T> void publishToAllExcept(long excludeWampSessionId, String topic, @Nullable Collection<T> arguments)
      Creates a new event and sends it to all Subscribers of the topic except to the Subscriber with the provided WAMP session id
      Parameters:
      excludeWampSessionId -
      topic - the topic to send the event to
      arguments - a collection of event arguments
    • publishToAllExcept

      public <T> void publishToAllExcept(long excludeWampSessionId, String topic, @Nullable Map<String,T> arguments)
      Creates a new event and sends it to all Subscribers of the topic except to the Subscriber with the provided WAMP session id
      Parameters:
      excludeWampSessionId -
      topic - the topic to send the event to
      arguments - a map with event arguments
    • publishMessageBuilder

      public PublishMessage.Builder publishMessageBuilder(String topic)
      Creates a new builder for a PublishMessage
      Parameters:
      topic - the topic
      Returns:
      the PublishMessage builder instance