Package ch.rasc.wamp2spring
Class WampPublisher
java.lang.Object
ch.rasc.wamp2spring.WampPublisher
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
ConstructorsConstructorDescriptionWampPublisher(org.springframework.messaging.MessageChannel clientInboundChannel) Creates a new WAMP publisher that sends events over the provided channel -
Method Summary
Modifier and TypeMethodDescriptionvoidpublish(PublishMessage publishMessage) Sends an arbitraryPublishMessageto the Broker.publishMessageBuilder(String topic) Creates a new builder for aPublishMessage<T> voidpublishTo(long eligibleWampSessionId, String topic, Collection<T> arguments) Creates a new event and sends it to a one specific Subscriber of the topic<T> voidCreates a new event and sends it to a one specific Subscriber of the topic<T> voidCreates a new event and sends it to a one specific Subscriber of the topic<T> voidpublishTo(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> voidCreates a new event and sends it to a specific group of Subscribers of the topic<T> voidpublishTo(Collection<Long> eligibleWampSessionIds, String topic, T... arguments) Creates a new event and sends it to a specific group of Subscribers of the topic<T> voidpublishToAll(String topic, Collection<T> arguments) Creates a new event and sends it to all Subscribers of the topic<T> voidpublishToAll(String topic, Map<String, T> arguments) Creates a new event and sends it to all Subscribers of the topic<T> voidpublishToAll(String topic, T... arguments) Creates a new event and sends it to all Subscribers of the topic<T> voidpublishToAllExcept(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> voidpublishToAllExcept(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> voidpublishToAllExcept(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> voidpublishToAllExcept(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> voidpublishToAllExcept(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> voidpublishToAllExcept(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
-
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
Sends an arbitraryPublishMessageto the Broker.- Parameters:
publishMessage- thePublishMessageinstance
-
publishToAll
Creates a new event and sends it to all Subscribers of the topic- Parameters:
topic- the topic to send the event toarguments- a variable number of event arguments
-
publishToAll
Creates a new event and sends it to all Subscribers of the topic- Parameters:
topic- the topic to send the event toarguments- a collection of event arguments
-
publishToAll
Creates a new event and sends it to all Subscribers of the topic- Parameters:
topic- the topic to send the event toarguments- 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 totopic- the topic to send the event toarguments- 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 toarguments- 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 toarguments- a map with event arguments
-
publishTo
Creates a new event and sends it to a one specific Subscriber of the topic- Parameters:
eligibleWampSessionId-topic- the topic to send the event toarguments- 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 toarguments- 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 toarguments- 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 toarguments- 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 toarguments- 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 toarguments- 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 toarguments- 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 toarguments- 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 toarguments- a map with event arguments
-
publishMessageBuilder
Creates a new builder for aPublishMessage- Parameters:
topic- the topic- Returns:
- the
PublishMessagebuilder instance
-