public abstract class PubsubBus extends Object implements hudson.ExtensionPoint
Constructor and Description |
---|
PubsubBus() |
Modifier and Type | Method and Description |
---|---|
static PubsubBus |
getBus()
Get the installed
PubsubBus implementation. |
void |
publish(Message message)
Publish a message on a channel.
|
protected abstract ChannelPublisher |
publisher(String channelName)
Get/create a new
ChannelPublisher instance for the specified
channel name. |
abstract void |
shutdown()
Shutdown the bus.
|
abstract void |
subscribe(String channelName,
ChannelSubscriber subscriber,
org.acegisecurity.Authentication authentication,
EventFilter eventFilter)
Subscribe to events on the specified event channel.
|
abstract void |
unsubscribe(String channelName,
ChannelSubscriber subscriber)
Unsubscribe from events on the specified event channel.
|
@Nonnull public static PubsubBus getBus()
PubsubBus
implementation.PubsubBus
implementation, or default
implementation if none are found.public void publish(@Nonnull Message message) throws MessageException
The message instance must have the channel
and event
name properties set on it.
message
- The message properties.MessageException
@Nonnull protected abstract ChannelPublisher publisher(@Nonnull String channelName)
ChannelPublisher
instance for the specified
channel name.channelName
- The channel name.ChannelPublisher
instance.public abstract void subscribe(@Nonnull String channelName, @Nonnull ChannelSubscriber subscriber, @Nonnull org.acegisecurity.Authentication authentication, @CheckForNull EventFilter eventFilter)
channelName
- The channel name.subscriber
- The subscriber instance that will receive the events.authentication
- The authentication to which the subscription is associated.eventFilter
- A message filter, or null
if no filtering is to be applied.
This tells the bus to only forward messages that match the properties
(names and values) specified in the filter.public abstract void unsubscribe(@Nonnull String channelName, @Nonnull ChannelSubscriber subscriber)
channelName
- The channel name.subscriber
- The subscriber instance that was used to receive events.public abstract void shutdown()
Copyright © 2016–2019. All rights reserved.