Clustering: Max Messages Behavior
To prevent the action that is specified in the Max Messages Behavior
attribute from causing a problem, ensure that there is sufficient memory available in your system and that you specify a value in the Max Messages
attribute such that the Max Messages Behavior
is never implemented.
In a cluster, the Reject New Messages
behavior is used to indicate that messages should not be discarded, if they are forwarded from a remote server; the messages are queued even though this action might mean that the limit specified in the Max Messages
attribute of the messaging policy is exceeded. If messages are being published locally, and a subscription has Reject New Messages
behavior, the local publish, and forwarding, will fail as it would in a non-clustered environment.
When a message is published on the same server as a subscription, the server knows the behavior that the subscription is using and, if Reject New Messages
is specified, the publish fails if there is a subscriber that has already reached its Max Messages
limit.
However, in a cluster, if a message is published on a remote server, the information that indicates that it should be forwarded to another server in the cluster is limited; the remote server is aware only that the topic is of interest to one or more subscribers on another server, or servers, in the cluster. In this situation, it is possible for the message to be forwarded to a server and be published to some subscribers that would reject the message because they have reached their Max Messages
limit, and cause the original publish to fail. However, it is possible that the same message is published successfully to other subscribers because they have not reached their Max Messages
limit and, therefore, the publish operation is successful and cannot be failed. The resulting stranded message cannot be forwarded to those subscribers that have reached their Max Messages
limit and prevents the forwarding of subsequent messages.
To avoid more messages building up than was originally specified by the Max Messages
limit, consider specifying Reject New Messages
for only those applications that must receive all messages that are published for them in a cluster. Specify Discard Old Messages
to ensure that the most recent messages are delivered to subscribers while the size of their message backlog is kept to a minimum.