Package org.jenkinsci.plugins.pubsub
Class GuavaPubsubBus
java.lang.Object
org.jenkinsci.plugins.pubsub.PubsubBus
org.jenkinsci.plugins.pubsub.GuavaPubsubBus
- All Implemented Interfaces:
ExtensionPoint
Default
PubsubBus 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected ChannelPublisherGet/create a newChannelPublisherinstance for the specified channel name.voidshutdown()Shutdown the bus.voidstart()will start the bus if it has been shutdown do not restart if already startedvoidsubscribe2(String channelName, ChannelSubscriber subscriber, org.springframework.security.core.Authentication authentication, EventFilter eventFilter) Subscribe to events on the specified event channel.voidunsubscribe(String channelName, ChannelSubscriber subscriber) Unsubscribe from events on the specified event channel.
-
Constructor Details
-
GuavaPubsubBus
public GuavaPubsubBus()
-
-
Method Details
-
publisher
Description copied from class:PubsubBusGet/create a newChannelPublisherinstance for the specified channel name.- Specified by:
publisherin classPubsubBus- Parameters:
channelName- The channel name.- Returns:
- The
ChannelPublisherinstance.
-
subscribe2
public void subscribe2(@NonNull String channelName, @NonNull ChannelSubscriber subscriber, @NonNull org.springframework.security.core.Authentication authentication, @CheckForNull EventFilter eventFilter) Description copied from class:PubsubBusSubscribe to events on the specified event channel.- Overrides:
subscribe2in 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, ornullif 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
Description copied from class:PubsubBusUnsubscribe from events on the specified event channel.- Specified by:
unsubscribein classPubsubBus- Parameters:
channelName- The channel name.subscriber- The subscriber instance that was used to receive events.
-
start
public void start()Description copied from class:PubsubBuswill start the bus if it has been shutdown do not restart if already started -
shutdown
public void shutdown()Description copied from class:PubsubBusShutdown the bus.
-