IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Retrieving documents from Dead Letter Queue

    Posted Tue September 15, 2015 03:08 PM

    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.!


    #Universal-Messaging-Broker
    #broker
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Retrieving documents from Dead Letter Queue

    Posted Mon September 21, 2015 03:10 AM


  • 3.  RE: Retrieving documents from Dead Letter Queue

    Posted Mon September 21, 2015 03:25 AM


  • 4.  RE: Retrieving documents from Dead Letter Queue

    Posted Mon September 21, 2015 04:04 AM

    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);
    
    }
    
    }
    

    #Universal-Messaging-Broker
    #webMethods
    #Integration-Server-and-ESB
    #broker


  • 5.  RE: Retrieving documents from Dead Letter Queue

    Posted Mon September 21, 2015 04:07 AM


  • 6.  RE: Retrieving documents from Dead Letter Queue

    Posted Mon September 21, 2015 08:35 AM

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

    Thanks in advance,
    Arun


    #Universal-Messaging-Broker
    #webMethods
    #broker
    #Integration-Server-and-ESB


  • 7.  RE: Retrieving documents from Dead Letter Queue

    Posted Mon September 21, 2015 08:57 AM

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


    #Universal-Messaging-Broker
    #broker
    #webMethods
    #Integration-Server-and-ESB


  • 8.  RE: Retrieving documents from Dead Letter Queue

    Posted Mon September 21, 2015 09:22 AM

    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.


    #broker
    #Integration-Server-and-ESB
    #Universal-Messaging-Broker
    #webMethods