Constructor and Description |
---|
BatchPublisher(String name,
BatchPublisherConfiguration configuration)
This constructs the thread pool of worker threads.
|
Modifier and Type | Method and Description |
---|---|
void |
publish(T message)
Offers the message to the queue.
|
protected abstract void |
publishMessages(List<T> messages)
This is invoked by the worker threads to have the passed in messages published immediately.
|
void |
shutdown()
This shutdowns the worker threads, and then calls
shutdownPublisher() . |
protected abstract void |
shutdownPublisher()
This is invoked by
shutdown() . |
void |
startup()
This first initializes the worker threads that monitor the queue of items to publish, and then calls
startupPublisher() . |
protected abstract void |
startupPublisher()
This is invoked by
startup() . |
public BatchPublisher(String name, BatchPublisherConfiguration configuration)
startup()
.name
- Name given to the thread pool worker threads.configuration
- queue management and thread pool configuration settings.protected abstract void startupPublisher() throws ResourceException
startup()
. This should be implemented to initialize any resources that need
to be started when the publisher is started. For example, opening shared connections to remote services.ResourceException
- if there is trouble starting the publisher.protected abstract void shutdownPublisher() throws ResourceException
shutdown()
. This should be implemented to clean up any resources that were
initialized in startup. For exmaple, closing the connections to remote services.ResourceException
- if there is trouble shutting down the publisher.protected abstract void publishMessages(List<T> messages)
messages
- the messages to publish immediately.public final void startup() throws ResourceException
startupPublisher()
.startup
in interface Publisher<T>
ResourceException
- If there is trouble starting up the publisher or starting the worker threads.public final void shutdown() throws ResourceException
shutdownPublisher()
.shutdown
in interface Publisher<T>
ResourceException
- if there is trouble shutting down the publisher or stopping the worker threads.Copyright © 2025 Open Identity Platform Community. All rights reserved.