Package org.jenkinsci.plugins.pubsub
Class GuavaPubsubBus
- java.lang.Object
-
- org.jenkinsci.plugins.pubsub.PubsubBus
-
- org.jenkinsci.plugins.pubsub.GuavaPubsubBus
-
- All Implemented Interfaces:
ExtensionPoint
public final class GuavaPubsubBus extends PubsubBus
DefaultPubsubBus
implementation.An in-memory implementation based on Google's Guava EventBus.
Use system property
org.jenkins.pubsub.GuavaPubsubBus.MAX_THREADS
to configure the thread pool size used by the bus. The default value is 5 threads (falling back to 0 when idle).- Author:
- tom.fennelly@gmail.com
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description GuavaPubsubBus()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ChannelPublisher
publisher(String channelName)
Get/create a newChannelPublisher
instance for the specified channel name.void
shutdown()
Shutdown the bus.void
start()
will start the bus if it has been shutdown do not restart if already startedvoid
subscribe2(String channelName, ChannelSubscriber subscriber, org.springframework.security.core.Authentication authentication, EventFilter eventFilter)
Subscribe to events on the specified event channel.void
unsubscribe(String channelName, ChannelSubscriber subscriber)
Unsubscribe from events on the specified event channel.
-
-
-
Method Detail
-
publisher
@NonNull protected ChannelPublisher publisher(@NonNull String channelName)
Description copied from class:PubsubBus
Get/create a newChannelPublisher
instance for the specified channel name.- Specified by:
publisher
in classPubsubBus
- Parameters:
channelName
- The channel name.- Returns:
- The
ChannelPublisher
instance.
-
subscribe2
public void subscribe2(@NonNull String channelName, @NonNull ChannelSubscriber subscriber, @NonNull org.springframework.security.core.Authentication authentication, @CheckForNull EventFilter eventFilter)
Description copied from class:PubsubBus
Subscribe to events on the specified event channel.- Overrides:
subscribe2
in classPubsubBus
- 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 void unsubscribe(@NonNull String channelName, @NonNull ChannelSubscriber subscriber)
Description copied from class:PubsubBus
Unsubscribe from events on the specified event channel.- Specified by:
unsubscribe
in classPubsubBus
- Parameters:
channelName
- The channel name.subscriber
- The subscriber instance that was used to receive events.
-
start
public void start()
Description copied from class:PubsubBus
will start the bus if it has been shutdown do not restart if already started
-
-