public final class GuavaPubsubBus extends PubsubBus
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).
Constructor and Description |
---|
GuavaPubsubBus() |
Modifier and Type | Method and Description |
---|---|
protected ChannelPublisher |
publisher(String channelName)
Get/create a new
ChannelPublisher instance for the specified
channel name. |
void |
shutdown()
Shutdown the bus.
|
void |
subscribe(String channelName,
ChannelSubscriber subscriber,
org.acegisecurity.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.
|
@Nonnull protected ChannelPublisher publisher(@Nonnull String channelName)
PubsubBus
ChannelPublisher
instance for the specified
channel name.publisher
in class PubsubBus
channelName
- The channel name.ChannelPublisher
instance.public void subscribe(@Nonnull String channelName, @Nonnull ChannelSubscriber subscriber, @Nonnull org.acegisecurity.Authentication authentication, @CheckForNull EventFilter eventFilter)
PubsubBus
subscribe
in class PubsubBus
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 void unsubscribe(@Nonnull String channelName, @Nonnull ChannelSubscriber subscriber)
PubsubBus
unsubscribe
in class PubsubBus
channelName
- The channel name.subscriber
- The subscriber instance that was used to receive events.Copyright © 2016–2019. All rights reserved.