Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Subscribing to and Receiving Events | Detecting Deadletters | Creating a Deadletter Subscription
 
Creating a Deadletter Subscription
To subscribe to dead letters, you use the BrokerClient.newSubscription method. In the filter parameter for this method, you specify the DeadLetterOnly hint.
As shown in the following examples, you can use wildcards to specify the types of events for which you want to receive dead letters.
The following code fragment shows how you would create a dead letter subscription for a specific event type.
BrokerClient c;
. . .
/* Create a deadletter subscription for an event type*/
try {
c.newSubscription("APITest::SimpleEvent","{hint:DeadLetterOnly})";
catch (BrokerException ex) {
System.out.println("Error on create subscription\n"+ex);
return;
}
. . .
The following code fragment show how you would use a wildcard character to create a dead letter subscription to all events in a particular namespace.
BrokerClient c;
. . .
/* Create a deadletter subscription for all events in a namespace*/
try {
c.newSubscription("APITest::*","{hint:DeadLetterOnly})";
catch (BrokerException ex) {
System.out.println("Error on create subscription\n"+ex);
return;
}
. . .
The following code fragment show how you would use the wildcard character to create a dead letter subscription for all events.
BrokerClient c;
. . .
/* Create a deadletter subscription for all event types*/
try {
c.newSubscription("*","{hint:DeadLetterOnly})";
catch (BrokerException ex) {
System.out.println("Error on create subscription\n"+ex);
return;
}
. . .