 |
- Summary:
- Nested |
- Field |
- Constr |
- Method
- Detail:
- Field |
- Constr |
- Method
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods
Modifier and Type |
Method and Description |
static MessageListenerContainer |
create(MongoTemplate template)
|
Optional<Subscription> |
lookup(SubscriptionRequest<?,?,?> request)
|
<S,T> Subscription |
register(SubscriptionRequest<S,? super T,? extends SubscriptionRequest.RequestOptions> request,
Class<T> bodyType)
|
<S,T> Subscription |
register(SubscriptionRequest<S,? super T,? extends SubscriptionRequest.RequestOptions> request,
Class<T> bodyType,
ErrorHandler errorHandler)
|
default <T> Subscription |
register(SubscriptionRequest<T,Object,? extends SubscriptionRequest.RequestOptions> request)
|
void |
remove(Subscription subscription)
|
-
-
Method Detail
-
register
<S,T> Subscription register(SubscriptionRequest<S,? super T,? extends SubscriptionRequest.RequestOptions> request,
Class<T> bodyType,
ErrorHandler errorHandler)
Register a new SubscriptionRequest in the container. If the is
already running the Subscription will be added and run immediately, otherwise it'll be scheduled and
started once the container is actually started .
MessageListenerContainer container = ...
MessageListener, Document> messageListener = (message) -> message.getBody().toJson();
ChangeStreamRequest request = new ChangeStreamRequest<>(messageListener, () -> "collection-name");
Subscription subscription = container.register(request, Document.class);
On Lifecycle.stop() all subscriptions are cancelled prior to shutting
down the container itself.
Registering the very same SubscriptionRequest more than once simply returns the already existing
Subscription .
Unless a Subscription is removed form the container, the Subscription
is restarted once the container itself is restarted.
Errors during Message retrieval are delegated to the given ErrorHandler .
- Parameters:
request - must not be null.
type - the exact target or a more concrete type of the Message.getBody() . Must not be null.
errorHandler - the callback to invoke when retrieving the Message from the data source fails for some
reason.
- Returns:
- never null.
- Summary:
- Nested |
- Field |
- Constr |
- Method
- Detail:
- Field |
- Constr |
- Method
|
|