Package org.jenkinsci.plugins.pubsub
Class PubsubBus
- java.lang.Object
-
- org.jenkinsci.plugins.pubsub.PubsubBus
-
- All Implemented Interfaces:
ExtensionPoint
- Direct Known Subclasses:
GuavaPubsubBus
public abstract class PubsubBus extends Object implements ExtensionPoint
Abstract Pub-sub bus.- Author:
- tom.fennelly@gmail.com
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description PubsubBus()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static PubsubBus
getBus()
Get the installedPubsubBus
implementation.void
publish(Message message)
Publish a message on a channel.protected abstract ChannelPublisher
publisher(String channelName)
Get/create a newChannelPublisher
instance for the specified channel name.abstract void
shutdown()
Shutdown the bus.void
start()
will start the bus if it has been shutdown do not restart if already startedvoid
subscribe(String channelName, ChannelSubscriber subscriber, Authentication authentication, EventFilter eventFilter)
Deprecated.void
subscribe2(String channelName, ChannelSubscriber subscriber, org.springframework.security.core.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.
-
-
-
Method Detail
-
getBus
@NonNull public static PubsubBus getBus()
Get the installedPubsubBus
implementation.- Returns:
- The installed
PubsubBus
implementation, or default implementation if none are found.
-
publish
public void publish(@NonNull Message message) throws MessageException
Publish a message on a channel.The message instance must have the
channel
andevent
name properties set on it.- Parameters:
message
- The message properties.- Throws:
MessageException
-
publisher
@NonNull protected abstract ChannelPublisher publisher(@NonNull String channelName)
Get/create a newChannelPublisher
instance for the specified channel name.- Parameters:
channelName
- The channel name.- Returns:
- The
ChannelPublisher
instance.
-
subscribe
@Deprecated public void subscribe(@NonNull String channelName, @NonNull ChannelSubscriber subscriber, @NonNull Authentication authentication, @CheckForNull EventFilter eventFilter)
Deprecated.Subscribe to events on the specified event channel.- Parameters:
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, ornull
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.
-
subscribe2
public void subscribe2(@NonNull String channelName, @NonNull ChannelSubscriber subscriber, @NonNull org.springframework.security.core.Authentication authentication, @CheckForNull EventFilter eventFilter)
Subscribe to events on the specified event channel.- Parameters:
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, ornull
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.
-
unsubscribe
public abstract void unsubscribe(@NonNull String channelName, @NonNull ChannelSubscriber subscriber)
Unsubscribe from events on the specified event channel.- Parameters:
channelName
- The channel name.subscriber
- The subscriber instance that was used to receive events.
-
shutdown
public abstract void shutdown()
Shutdown the bus.
-
start
public void start()
will start the bus if it has been shutdown do not restart if already started
-
-