public interface IBlaubotChannel
subscribe(IBlaubotMessageListener)
and subscribe()
methods.
Additional message listeners can be added using addMessageListener(IBlaubotMessageListener)
or removed using removeMessageListener(IBlaubotMessageListener)
.
A subscription can be removed using unsubscribe()
.
A channel uses a message queue that is drained using a defined IBlaubotMessagePickerStrategy
.
To send messages, use the publish methods.
The picking strategy and some other configurations can be changed at runtime, using the BlaubotChannelConfig
, which is retrievable using getChannelConfig()
.Modifier and Type | Method and Description |
---|---|
void |
addMessageListener(IBlaubotMessageListener messageListener)
Add a message listener to this channel to get notifications when messages arrive.
|
void |
clearMessageQueue()
Clears the message queue.
|
BlaubotChannelConfig |
getChannelConfig()
Gets the channel config
|
boolean |
publish(BlaubotMessage blaubotMessage)
Deprecated.
we don't allow the pre-creation of BlaubotMessages anymore
|
boolean |
publish(BlaubotMessage blaubotMessage,
boolean excludeSender)
Deprecated.
we don't allow the pre-creation of BlaubotMessages anymore
|
boolean |
publish(BlaubotMessage blaubotMessage,
long timeout)
Deprecated.
we don't allow the pre-creation of BlaubotMessages anymore
|
boolean |
publish(BlaubotMessage blaubotMessage,
long timeout,
boolean excludeSender)
Deprecated.
we don't allow the pre-creation of BlaubotMessages anymore
|
boolean |
publish(byte[] payload)
Post the payload to this channel's queue.
|
boolean |
publish(byte[] payload,
boolean excludeSender)
Post the payload to this channel's queue.
|
boolean |
publish(byte[] payload,
long timeout)
Post the payload to this channel's queue.
|
boolean |
publish(byte[] payload,
long timeout,
boolean excludeSender)
Post the payload to this channel's queue.
|
void |
removeMessageListener(IBlaubotMessageListener messageListener)
Removes a previously added message listener from this channel
If after the operation no listener is attached to this channel anymore, unsubscribe() is
called automatically.
|
void |
subscribe()
Subscribes to the channel
|
void |
subscribe(IBlaubotMessageListener blaubotMessageListener)
Subscribes to this channel and attaches a message listener
|
void |
unsubscribe()
Remove the subscription of this channel
|
boolean publish(BlaubotMessage blaubotMessage)
blaubotMessage
- the messageboolean publish(BlaubotMessage blaubotMessage, boolean excludeSender)
blaubotMessage
- the messageexcludeSender
- if true, the message will not be dispatched back to this channel but to all other subscribers.boolean publish(BlaubotMessage blaubotMessage, long timeout)
blaubotMessage
- the mssagetimeout
- the timeout in msboolean publish(BlaubotMessage blaubotMessage, long timeout, boolean excludeSender)
blaubotMessage
- the mssagetimeout
- the timeout in msexcludeSender
- if true, the message will not be dispatched back to this channel but to all other subscribers.boolean publish(byte[] payload)
payload
- the payload as byte arrayboolean publish(byte[] payload, boolean excludeSender)
payload
- the payload as byte arrayexcludeSender
- if true, the message will not be dispatched back to this channel but to all other subscribers.boolean publish(byte[] payload, long timeout)
payload
- the payload as byte arraytimeout
- the timeout in msboolean publish(byte[] payload, long timeout, boolean excludeSender)
payload
- the payload as byte arraytimeout
- the timeout in msexcludeSender
- if true, the message will not be dispatched back to this channel but to all other subscribers.void subscribe(IBlaubotMessageListener blaubotMessageListener)
blaubotMessageListener
- the listener to be informed about new messages on this channelvoid subscribe()
void unsubscribe()
BlaubotChannelConfig getChannelConfig()
void clearMessageQueue()
void addMessageListener(IBlaubotMessageListener messageListener)
messageListener
- the message listener to addvoid removeMessageListener(IBlaubotMessageListener messageListener)
messageListener
- the listener to remove