Retrieving documents from Dead Letter Queue

Hi,
I am able to successfully create a BrokerClient and subscribe to all documents.
The following code is doing that.

String broker_host = “localhost:6849”;
String broker_name = null;
String client_group = “eventLog”;
BrokerClient c;

try {
c = new BrokerClient(broker_host, broker_name, null,
client_group, “Sample#1”,null);
} catch (BrokerException ex) {
com.wm.util.JournalLogger.log(3,90,3,“Exception while creating client”+ex );
return;
}

/* Create a dead letter subscription for all event types*/

try {
c.newSubscription(“*”,“{hinteadLetterOnly}”);
} catch (BrokerException e) {
e.printStackTrace();
}

I can see the documents when published without subscribers use the above mentioned client and the client group in MWS.
My question is, how do I retrieve the published documents back ?

I’m using wM 9.6
Any leads are appriciated.!

Did anyone find any leads on this ?

Have you tried to use getEvent method?

Thanks a ton!
It worked.

Here’s my code. I am hardcoding the client ID now. But I guess I have to find a way to dynamically get it (by writing to file maybe).

===CODE====

public static final void onemore(IData pipeline) throws ServiceException {
String broker_host = “localhost:6849”;
String broker_name = null;
String client_group = “eventLog”;
BrokerClient c;
String client_id;
client_id =“#gclient21-3”;

	  //id= c.getClientId();
	  try {
		  c = BrokerClient.reconnect(broker_host, broker_name,
				  client_id, null);
		  com.wm.util.JournalLogger.log(3,90,3,"Client working"+ client_id );
		 
		  try {
			   
			  BrokerEvent[] s= new BrokerEvent[10];
			  s= c.getEvents(10,-1);
			  for(BrokerEvent str: s){
				  com.wm.util.JournalLogger.log(3,90,3,"Event Types :" + str.getBaseTypeName());  
			  }
			  
			  com.wm.util.JournalLogger.log(3,90,3,"Length of te Queue: " + c.getQueueLength());
		  }catch(BrokerException ex){
			  com.wm.util.JournalLogger.log(3,90,3,"Catch Block: Couldn't Print Queue: " + ex);
			  //com.wm.util.JournalLogger.log(3,90,3,"EventBrowse Try Block" + s.length);
		  }
		  
		  
		  try {
			  c.disconnect();
			  } catch (BrokerException ex) {
				  com.wm.util.JournalLogger.log(3,90,3,"Catch block disconnect"+ex);
			  } 
		 		  
		  
		  } 
		  catch (BrokerException ex) {
			  
		    com.wm.util.JournalLogger.log(3,90,3,"Client ID not working"+ ex);
		    
		  }
	  
}

Glad to hear that.

Is there any way we can achieve through flow service instead of writing java code .

Thanks in advance,
Arun

Use trigger or pub/sub related build-in services.

Hi Arun,
If you know the document types that might end up in the DLQ beforehand, then you could use a trigger with {hint: DeadLetterOnly=true} for all those document types.

In my case, I had to create a client for all possible anonymous document types. So I went with Java Service.