public class RotatingServerAdvice extends AbstractMessageSourceAdvice
| Modifier and Type | Class and Description |
|---|---|
static class |
RotatingServerAdvice.KeyDirectory
A
DelegatingSessionFactory key/directory pair. |
static interface |
RotatingServerAdvice.RotationPolicy
Implementations can reconfigure the message source before and/or after
a poll.
|
static class |
RotatingServerAdvice.StandardRotationPolicy
Standard rotation policy; iterates over key/directory pairs; when the end
is reached, starts again at the beginning.
|
| Constructor and Description |
|---|
RotatingServerAdvice(DelegatingSessionFactory<?> factory,
java.util.List<RotatingServerAdvice.KeyDirectory> keyDirectories)
Create an instance that rotates to the next server/directory if no message is
received.
|
RotatingServerAdvice(DelegatingSessionFactory<?> factory,
java.util.List<RotatingServerAdvice.KeyDirectory> keyDirectories,
boolean fair)
Create an instance that rotates to the next server/directory depending on the fair
argument.
|
RotatingServerAdvice(RotatingServerAdvice.RotationPolicy rotationPolicy)
Construct an instance that rotates according to the supplied
RotatingServerAdvice.RotationPolicy. |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.messaging.Message<?> |
afterReceive(org.springframework.messaging.Message<?> result,
MessageSource<?> source)
Subclasses can take actions based on the result of the poll; e.g.
|
boolean |
beforeReceive(MessageSource<?> source)
Subclasses can decide whether to proceed with this poll.
|
invokepublic RotatingServerAdvice(DelegatingSessionFactory<?> factory, java.util.List<RotatingServerAdvice.KeyDirectory> keyDirectories)
factory - the DelegatingSessionFactory.keyDirectories - a list of RotatingServerAdvice.KeyDirectory.public RotatingServerAdvice(DelegatingSessionFactory<?> factory, java.util.List<RotatingServerAdvice.KeyDirectory> keyDirectories, boolean fair)
factory - the DelegatingSessionFactory.keyDirectories - a list of RotatingServerAdvice.KeyDirectory.fair - true to rotate on every poll, false to rotate when no message is received.public RotatingServerAdvice(RotatingServerAdvice.RotationPolicy rotationPolicy)
RotatingServerAdvice.RotationPolicy.rotationPolicy - the policy.public boolean beforeReceive(MessageSource<?> source)
MessageSourceMutatorsource - the message source.public org.springframework.messaging.Message<?> afterReceive(org.springframework.messaging.Message<?> result,
MessageSource<?> source)
MessageSourceMutatortrigger. The message can also be replaced with a new one.result - the received message.source - the message source.