Universal Messaging 10.3 | Concepts | Commonly Used Features | Pause Publishing
 
Pause Publishing
The pause publishing feature allows all client publishing to the server to be paused, across channels, queues and data groups. This pause does not affect the administration API, inter-cluster communication or joins.
The feature is activated by setting the server configuration property PauseServerPublishing to true. Then, clients trying to publish or commit will receive nPublishPausedException.
See the section Realm Configuration in the Developer Guide for a description of the configuration property.
The sections below describe how publish methods are affected when publishing is paused.
JMS Publishing
Transactional
A commit will throw a JMSException with a message containing "Publishing paused". The root exception will be nPublishPausedException which inherits nSessionPausedException.
The publish calls before the commit will throw an asynchronous JMSException if an asynchronous exception listener is attached.
Note:
The first call of a publish will not throw an exception because of an optimization, whereby the first published event is in fact not sent to the server until a commit or a second publish is in place.
Non-transactional send
The send calls throw an asynchronous JMSException if an asynchronous exception listener is attached.
Note:
The first call of a publish will not throw an exception because of an optimization, whereby the first published event is in fact not sent to the server until a commit or a second publish is in place.
Non-transactional SYNC send (syncSendPersistent = true)
The send calls will throw a synchronous JMSException.
The root cause of the JMSException is nPublishPausedException, and can be checked for example with this code:
} catch (JMSException e) {
Throwable rootCause = findRootCause(e);
assertTrue(rootCause instanceof nPublishPausedException);
}
Throwable findRootCause(Throwable e){
Throwable cause = e.getCause();
return (cause != null ? findRootCause(cause) : e);
}
Native Java Publishing
Transactional
nTransaction.commit will result in nPublishPausedException which inherits nSessionPausedException.
The publish calls before the commit will throw an asynchronous nPublishPausedException if an asynchronous exception listener is attached.
Note:
The first call of a publish will not throw an exception because of an optimization, whereby the first published event is in fact not sent to the server until a commit or a second publish is in place.
Non transactional
The publish calls will throw an asynchronous nPublishPausedException if an asynchronous exception listener is attached.
C++/C#
The exceptions for C++ and C# are the same as for the Java native API.
MQTT, AMQP and JavaScript
The exceptions for MQTT, AMQP and JavaScript when publishing is paused are handled as follows:
MQTT:
Currently, the MQTT protocol does not provide mechanisms to return proper errors to publishers. To handle publish exceptions (in particular, when publishing is paused), Universal Messaging provides two options: either ignore the exception, or disconnect the publisher's connection. This is configured using the DisconnectClientsOnPublishFailure MQTT configuration setting.
AMQP:
A standard AMQP error amqp:internal-error will be returned to the publisher client if publishing is paused. The error message starts with "Publishing paused", so adopters can use this substring to identify the actual cause
JavaScript:
If there is a publish or commit while publishing is paused, an error with a description starting with "Publishing paused" will be returned.