@Target(value={TYPE,METHOD}) @Retention(value=RUNTIME) @Documented public @interface WampSubscribeListener
value()).
If no topicURI is provided the method listens for the topicURI 'beanName.methodName'
The method feed in the following example listens for SUBSCRIBE messages
that are sent to the topicURI 'myService.feed'.
The method subscribeNews is called by the library when a SUBSCRIBE message
with the topicURI '/topic/news' arrives.
@Service
public class MyService {
@WampSubscribeListener
public void feed() {
}
@WampSubscribeListener("/topic/news")
public void subscribeNews(SubscribeMessage message) {
}
}
When this method returns a non null value and the attribute replyTo()
specifies one or more destinations the return value is wrapped in an
EventMessage and sent to the broker which sends by default an EVENT message to
every subscriber of the listed replyTo() destinations.
excludeSender() attribute is true the sender of the SUBSCRIBE
message will not receive the EVENT message.broadcast() attribute is false only the sender of the SUBSCRIBE
message will receive the EVENT message.excludeSender() is true and broadcast() is false no one will
receive an EVENT message.| Modifier and Type | Optional Element and Description |
|---|---|
boolean[] |
authenticated
If true a call to this method has to be authenticated.
|
boolean |
broadcast
By default when the method has a return value and this value is not
null
and the attribute replyTo() is not empty an EventMessage is created and
sent to all subscribers of the listed topicURI(s)/destination(s). |
boolean |
excludeSender
Exclude the sender of the SUBSCRIBE message from the replyTo receivers.
|
String[] |
replyTo
If not empty the return value of this method (wrapped in an
EventMessage)
is sent to all subscribers of the listed topicURI(s)/destination(s). |
String[] |
value
One or more topicURI(s)/destination(s) the method should listen on.
|
public abstract String[] value
public abstract String[] replyTo
EventMessage)
is sent to all subscribers of the listed topicURI(s)/destination(s). This attribute
is ignored when the method does not have a return value or the return value is
null.public abstract boolean excludeSender
This attribute will be ignored when no EventMessage is created.
replyTo()public abstract boolean broadcast
null
and the attribute replyTo() is not empty an EventMessage is created and
sent to all subscribers of the listed topicURI(s)/destination(s).
If this attribute is set to false only the sender of the SUBSCRIBE message will receive the EVENT message.
If this attribute is false and excludeSender() is true no EVENT message
will be created. A non null return value will be ignored.
replyTo(),
excludeSender()public abstract boolean[] authenticated
Takes precedence over WampAuthenticated and the global setting
DefaultWampConfiguration.authenticationRequired()
Copyright © 2014–2017. All rights reserved.