Controlling whether applications can send or receive messages for a bus destination
We can prevent applications from either sending messages to, or receiving messages from, a destination. To do this you use the Receive allowed, Send allowed, and Receive exclusive properties of destinations to control access to destinations. When you save changes to those properties, this affects open producers and consumers attached to localization points for that destination.
Use this task to change the configuration properties of a bus destination to control whether applications can send messages to, or receive messages from, a destination. For example, some destinations only exist in order to be associated with mediations; applications should not be able to put to or get from such a destination.
The changes that we make affect the configuration of a bus destination and when saved, are automatically applied to all message points for that destination. We can make the same changes to an individual destination localization point to control access to only that one point.
When you save changes that affect the access to a bus destination, this affects producers or consumers attached to message points for that destination. For each producer or consumer, any existing operations are allowed to complete (except for one case, as described in the next paragraph). The producer or consumer then undergoes a state change to conform to the destination, and subsequent operations will fail with an exception. The exception message indicates the specific reason for the exception; that is, that the destination no longer accepts sending or receiving of messages.
The only case where this behavior does not occur is the receiveWithWait() method. Blocking receives are cancelled when the state change to the consumer is made, and an exception is thrown. So, a receiveWithWait() method that is outstanding at the time of the configuration change is not allowed to complete, although the exception still occurs asynchronously with the configuration change.
- Click Service integration -> Buses -> bus_name -> [Destination resources] Destinations -> destination_name.
- Optional: Change one or more of the following properties:
- Receive allowed
- Clear this check box (setting to the option to false) to prevent messages from being received from message points for this destination. The effect depends on the type of destination:
- Queue point. Any open consumers change state and an exception is thrown when the consumer requests a message.
- Publication point. Any messages that have been published to the messaging engine for a publication point are stopped from proceeding either to local consumers or onwards to other messaging engines. Local consumers get the same exception as for a queue point.
- Mediation point of a mediated destination. The bus stops the mediation instance running locally to the mediation point; other instances of the mediation running on other messaging engines continue as normal.
In all cases, messages can continue to be sent, and accumulate on the destination localization point.
- Send allowed
- Clear this check box (setting the option to false) to prevent messages from being accepted onto the message points for this destination.
- For a queue point of a non-mediated destination, or a mediation point of a mediated destination, new messages (from attached producers or forwarded from another destination) are redirected to any available message point. If no message points are available, then messages that have already been accepted onto the bus, and new messages from attached producers, are preserved by the bus until a message point becomes available. The only exception to this is the case of a destination with only one message point (queue point or mediation point depending on whether the destination is mediated or non-mediated), where the producer is attached to the same messaging engine. In this case, an exception is thrown on each send call. The exception message indicates that the reason for the exception is that the only extant localization has been disabled for send. The producer remains open as normal, and any more send calls succeed if the Send allowed property of the localization is reselected (reset to true).
- For a queue point of a mediated destination, clearing this Send allowed property alters the behavior of the mediation instances that are sending to the destination in the same way as setting it to false on a non-mediated destination affects producing applications: Messages are sent instead to any alternative message point. If no localizations are available, are preserved by the bus until a message point becomes available. For any mediation instance (that is, on any server that has a mediation point), if the same server hosts a queue point, and that queue point is the only queue point for the destination, then the mediation changes to the "stopped on error" state.
- For a publication point, clearing this Send allowed property stops applications attached locally to the topic space from publishing messages. The send calls receive an exception, and the producer remains open.
- Receive exclusive
- If we select this check box (setting the option to true), then only one consumer can be attached to any message point. This property is particularly intended for use with queues, but can be used with any type of destination.
- For a queue, the bus chooses a queue point for each request to create a consumer. If the selected queue point already has an attached consumer, then the call fails with an exception (containing an exception message and linked exception that indicate the precise nature of the failure). There is no guarantee that all available queue points are used before the exception is thrown.
- For a topic space, only one consumer can attach to any given messaging engine.
If we change the Receive exclusive property from false to true, some consumers are selected to be the exclusive receivers in accordance with the rules. All other consumers are detached from the destination, in the same way as is described above for a transition of the Receive allowed property from true to false.
- Click OK.
- Save the changes to the master configuration.