JMS Patterns - Generic Message Handler

Hi,
For those interested in Java EE patterns, I've created a [blog post|http://jonathanjwright.wordpress.com/2009/08/12/jms-patterns-generic-message-handler/] outlining the use of a generic message handler to simplify MDB message type checking and payload extraction.
Regards,
Jonathan

This requirement has now gone away after implementing SP21

Similar Messages

  • Oracle 10G JMS error : Failed to handle dispatch message ... exception ORABPEL-05002

    Hi All,
    We are using a JMS adapter as partner link in a BPEL process to produce messages to JMS Queue.
    We are getting an error while producing a message to a JMS Queue.
    The error comes for 1 or 2 instances among 5 to10 intsances. (all these instances ran with in 1 or 2 seconds).
    We are using Oracle 10G SOA suite.
    This error is getting in the Production environment.
    The error is as follows (took error from server log).
    Failed to handle dispatch message ... exception ORABPEL-05002
    Message handle error.
    An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.invoke.InvokeInstanceMessage"; the exception is: faultName: {{http://schemas.oracle.com/bpel/extension}bindingFault}
    messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
    parts: {{summary=file:/sw/appaia/product/SOA/bpel/domains/default/tmp/.bpel_CurrencyExchangeListEbizJMSProducer_1.0_4ec528ec93a8a6ff0278fab9701dcc71.tmp/CurrencyExchangeListEbizJMSProducerV1.wsdl [ Produce_Message_ptt::Produce_Message(OutputParameters) ] - WSIF JCA Execute of operation 'Produce_Message' failed due to: Adapter Framework unable to create outbound JCA connection.
    file:/sw/appaia/product/SOA/bpel/domains/default/tmp/.bpel_CurrencyExchangeListEbizJMSProducer_1.0_4ec528ec93a8a6ff0278fab9701dcc71.tmp/CurrencyExchangeListEbizJMSProducerV1.wsdl [ Produce_Message_ptt::Produce_Message(OutputParameters) ] - : The Adapter Framework was unable to establish an outbound JCA connection due to the following issue: oracle.j2ee.connector.proxy.ProxyInterceptException: javax.resource.ResourceException: RollbackException: Transaction has been marked for rollback: null [Caused by: RollbackException: Transaction has been marked for rollback: null]
    ; nested exception is:
    ORABPEL-12511
    Adapter Framework unable to create outbound JCA connection.
    I tried the below JMS tunings with differnt combination, but no improvement.
                <property name="useJCAConnectionPool">true</property>
                <property name="maxSizeJCAConnectionPool">500</property>
                <property name="retryMaxCount">10</property>
                <property name="retryInterval">60</property>
    Please let me know if any other logs or any other information is required.
    Thanks,
    Pershad

    sorry, I forgot the below things which I tried to tune the JMS.
    <property name="retryMaxCount">10</property>
    <property name="retryInterval">60</property>
    <property name="useJCAConnectionPool">true</property>
    <property name="maxSizeJCAConnectionPool">500</property>
    Thanks.

  • Generic error handler

    Im looking to implement a generic error/Exception handler centrally to this fairly large system.
    The error messages displayed to the user are also quite complex and will have to be created by the handler.
    If anyone has any ideas or can perhaps point me into the direction of a pattern etc it will be much appreciated.
    Thanks a million!!

    On a system I wrote previously, I used this.
    First, I have a series of classes that encapsulate user-readable messages.
    /** a message is a serialisable object.
    It's toString() method returns the text of a message
    suitable for being displayed to a user. */
    abstract class Message implements Serializable {}
    /** ToHtml tags an object as having a toHtml method. */
    interface ToHtml
      /** This method returns a string suitable for insertion into a
          JEditorPane with a content tyhpe of text/html, or for inclusion
          into a web page. */
      public String toHtml();
    class MessageList extends Message implements ToHtml {
    List messages = new ArrayList();
    void addMessage(Message msg) { ... }
    void addAllMessages(MessageList lst) { messages.addAll(lst.messages); }
    /** concatenate the messages into a list separated by line breaks. */
    String toString() {}
    /** concatenate the messages into a HTML UL list. Use the toHtml on each message
         that implements it. */
    String toHtml() {}
    /** a message that uses java.text.MessageFormat to format the params */
    class ParameterisedPlainMessage extends Message {
      java.text.MessageFormat pattern;
      Object[] arguments;
      String toString() { return pattern.format(arguments); }
    /** A message that includes both a plain-text format and an HTML format */
    class ParameterisedHtmlMessage extends ParametrisedPlainMessage implements toHtml {
      java.text.MessageFormat htmlPattern;
      String toHtml() { return htmlPattern.format(arguments); }
    }To create these message objects, I use a message factory:
    class MessageFactory {
       String pattern;
       String htmlPattern;
       MessageFactory(String message_key) {
         // get the message format for plain text
         // get the message format for html 
       MessageFactory(Class clazz, String message_key) {
          this(clazz.getName() + "." + message_key);
       Message create(Object[] args) {
         if(we have an html pattern) {
            return new ParameterisedHtmlMessage(pattern, htmlpattern, args);
         else {
            return new ParameterisedPlainMessage(pattern, args);
       Message create(Collection args)  { ... }
       Message create()  { ... }
       Message create(Object arg1)  { ... }
       Message create(Object arg1, Object arg2)  { ... }
       Message create(Object arg1, Object arg2, Object arg3)  { ... }
       Message create(Object arg1, Object arg2, Object arg3, Object arg4)  { ... }
       // etc etc
    }The text of the message formats will typically be in a resource bundle, some XML, or a properties
    file. The key of the message is usually a class or package name followed by an upper case
    identiier. If the message is only ever created in one particular class, then I use the class name,
    otherwise the name of the most reasonable package.
    Finally, the message formats end with an optional .plain or .html
    You use them like this:
    class Foo {
       private static final Message CANT_DO_THIS = new MessageFactory(Foo.class, "CANT_DO_THIS");
       private static final Message OK = new MessageFactory(Foo.class, "OK");
       Message bar(int because) {
         return because == 0 ? OK.create() : CANT_DO_THIS.create(new Integer(i));
    }with a properties file like this:
    quux.baz.Foo.CANT_DO_THIS.plain=Can't do this for a value of {0}.
    quux.baz.Foo.CANT_DO_THIS.html=<FONT color=\"red\">Can't do this</FONT> for a value of <B>{0}</B>.
    quux.baz.Foo.OK=All Ok.Now then. As to the question of exceptions.
    We have to distinguish between serious exceptions and exceptions that arise as part of normal processing. For instance, if one EJB gets a RemoteException when calling anoter, then this is
    serious. For these things, I use a class ContainerException which extends EJBException. EJBException is an unchecked exception, and always triggers a rollback of left uncaught.
    ContainerException has a constructor on it that takes a RemoteException (among others), and which
    spits out an WARNING level log line when it is constructed.
    For exceptions that arise as part of normal processing, I create a class BusinessException
    abstract class BusinessException extends Exception {}I have a concrete subclass of this:
    class MessageException extends BusinessException {
      Message msg;
      MessageException(Message msg) {}
      /** override getMessage */
      String etMessage() { return msg.toString(); }
      Message getMessageObject)( { return msg; }
    }If you want to catch specific business events, you can subclass this:
    class OutOfMoneyException {
      static MessageFactory OUT_OF_MONEY =
         new MessageFactory(OutOfMoneyException.class, "OUT_OF_MONEY");
       Person p;
      OutOfMoneyException(Person p) {
        super(OUT_OF_MONEY.create(p));
        this.p = p;
      Person getPerson() { return p; }
    }Or you can just build instances of MessageException without worring about subclassing them.
    class Account {
      static MessageFactory ACCOUNT_CLOSED =
         new MessageFactory(Account.class, "ACCOUNT_CLOSED");
      static MessageFactory ACCOUNT_LOCKED =
         new MessageFactory(Account.class, "ACCOUNT_LOCKED");
      void makeWithdrawal(int amt) throws BusinessException {
         if(account is closed)
         throw new MessageException(ACCOUNT_CLOSED.create(this));
         if(account is locked)
         throw new MessageException(ACCOUNT_LOCKED.create(this));
         if(coh < amt)
           throw new OutOfMoneyException(getPerson());
         coh -= amt;
    class DoSomeStuff {
      void doSomeStuff() throws BusinessException {
        boolean need_to_rollback = false;
        MessageList problems = new MessageList();
        for(wdl in withdrawal list) {
          try {
             wdl.getAccount().makeWithdrawal(wdl.getAmount());
          catch(OutOfMoneyException ex) {
            problems.add(ex.getMessageObject());
          catch(BusinessException ex) {
            // business exptions other than out of money mean
            // we must do a rollback.
            problems.add(ex.getMessageObject());
            need_to_rollback = true;
        if(need_to_rollback) transaction.rollBack();
        if(!problems.isEmpty()) throw new MessageException(problems); 
        // else, all ok.
    }And that about does it. You can then call popUpError(), which will use a JEditorPane to
    display the message in HTML to the user, so your messages may be as visually complex as you
    wish.

  • ORABPEL-05002 - Message handle error - Session has timed out or was invalid

    In our production environment we are facing this issue.
    We are trying to find the root cause to fix the issue.
    My Understanding:*
    In the below error message,
    we are able to see the Session has timed out or invalidated.
    Also we are able to see the Non-fatal connection error. I believe that when the MDB trying to process the dispatched message, it will invoke the message from invoke_message table of dehydration store. At this point of time it gets non-fatal connection error so we are gettign this error.
    I need to know the difference between fatal and non-fatal connection error. Is my understanding correct or not ?
    ORABPEL-05002
    Message handle error.
    An exception occurred while attempting to process the message *"com.collaxa.cube.engine.dispatch.message.system.RemoveMessage"; the exception is: Session has timed out or was invalidated*
    at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:207)
    at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
    at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
    at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.interceptor.system.SetContextActionInterceptor.invoke(SetContextActionInterceptor.java:44)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
    at oracle.j2ee.connector.messageinflow.MessageEndpointImpl.OC4J_invokeMethod(MessageEndpointImpl.java:297)
    at WorkerBean_EndPointProxy_4bin6i8.onMessage(Unknown Source)
    at oracle.j2ee.ra.jms.generic.WorkConsumer.run(WorkConsumer.java:266)
    at oracle.j2ee.connector.work.WorkWrapper.runTargetWork(WorkWrapper.java:242)
    at oracle.j2ee.connector.work.WorkWrapper.doWork(WorkWrapper.java:215)
    at oracle.j2ee.connector.work.WorkWrapper.run(WorkWrapper.java:190)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
    at java.lang.Thread.run(Thread.java:619)
    <2010-08-11 23:05:10,131> <ERROR> <WorkExecutorWorkerThread-129> <engine.dispatch> <DispatchHelper::handleMessage> failed to handle message
    java.rmi.NoSuchObjectException: Session has timed out or was invalidated
    at com.evermind.server.ejb.StatefulSessionEJBObject.throwPassivisationException(StatefulSessionEJBObject.java:335)
    at com.evermind.server.ejb.StatefulSessionEJBObject.remove_X(StatefulSessionEJBObject.java:174)
    at com.evermind.server.ejb.StatefulSessionEJBObject.remove_X(StatefulSessionEJBObject.java:159)
    at com.evermind.server.ejb.LocalStatefulSessionEJBObject.remove(LocalStatefulSessionEJBObject.java:25)
    at com.collaxa.cube.engine.util.EngineBeanCache.releaseMessageBean(EngineBeanCache.java:293)
    at com.collaxa.cube.engine.dispatch.message.system.RemoveMessageHandler.handle(RemoveMessageHandler.java:36)
    at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:142)
    at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
    at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
    at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.interceptor.system.SetContextActionInterceptor.invoke(SetContextActionInterceptor.java:44)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
    at oracle.j2ee.connector.messageinflow.MessageEndpointImpl.OC4J_invokeMethod(MessageEndpointImpl.java:297)
    at WorkerBean_EndPointProxy_4bin6i8.onMessage(Unknown Source)
    at oracle.j2ee.ra.jms.generic.WorkConsumer.run(WorkConsumer.java:266)
    at oracle.j2ee.connector.work.WorkWrapper.runTargetWork(WorkWrapper.java:242)
    at oracle.j2ee.connector.work.WorkWrapper.doWork(WorkWrapper.java:215)
    at oracle.j2ee.connector.work.WorkWrapper.run(WorkWrapper.java:190)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
    at java.lang.Thread.run(Thread.java:619)
    <2010-08-11 23:05:10,132> <ERROR> <WorkExecutorWorkerThread-129> <engine.dispatch> *<DispatchHelper::handleMessage> Not fatal connection error ... not retrying: class com.oracle.bpel.client.ServerException: Session has timed out or was invalidated*
    <2010-08-11 23:05:10,132> <ERROR> <WorkExecutorWorkerThread-129> <engine.dispatch> *<BaseScheduledWorker::process> Failed to handle dispatch message ... exception ORABPEL-05002*
    Message handle error.
    An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.system.RemoveMessage"; the exception is: Session has timed out or was invalidated
    -----

    I'm having the same problem. I posted to VSM sample and Pooled ApplicationModule Maximum Inactive Age
    which seems to be a similar situation.
    Does anyone have any information on where this time out parameter is set on either the app module or OAS and how to handle this error correctly?
    Thanks,
    Brian

  • Sync/Async bridge via JMS with FAULT messages

    Hello all,<br><br>
    I set up a sync/async bridge scenario with using of JMS communication channel (SAP - JMSReceiverCC - JMSServer and application - JMSSenderCC - SAP). The normal communication works fine.<br>
    But what we can not solve is the Fault Message handling. If there is a application error behind the JMS, a fault message is generated instead of proper application response and sent back to XI. Without any additional setup of JMS Sender CC the processing of the message ends with "MAPPING - EXCEPTION_DURING_EXECUTE", because normal "response mapping" is executed instead of "fault message mapping". This is correct behavior without any discussion.<br><br>
    [SAPhelp|http://help.sap.com/saphelp_nw70/helpdata/en/45/202845de34072ce10000000a155369/frameset.htm] says that there are 2 module parameters to be set : fault, faultNamespace. The description is rather vague, so let's see, what the "NotifyResponseBean" does, when parameters fault/faultNamespace are filled:<br><br>
    <pre>if(fault != null && faultNamespace != null)
      if(faultNamespace.equals("http://sap.com/xi/XI/System"))
        ((XIMessage)message1).setMessageClass(MessageClass.SYSTEM_ERROR);
        ((XIMessage)message1).setError(fault, "no additional information");
      } else
        ((XIMessage)message1).setMessageClass(MessageClass.APPLICATION_ERROR);
        ErrorInfo errorinfo = message1.createErrorInfo();
        errorinfo.setAttribute("ApplicationFaultInterface", fault);
        errorinfo.setAttribute("ApplicationFaultInterfaceNamespace", faultNamespace);
        errorinfo.setAttribute("ErrorCode", fault);
        errorinfo.setAttribute("AdditionalErrorText", "no additional information");
        message1.setErrorInfo(errorinfo);
    } else
      ((XIMessage)message1).setMessageClass(MessageClass.APPLICATION_RESPONSE);
    }</pre><br>
    The code is pretty straight forward so one could assume, that it's the name and namespace of inbound synchronnous message interface what is supposed to be filled in the values of each parameter. And from that kind of information SAP XI can evolve how to handle the response, actually the fault.<br>
    Unfortunatelly the real situation is different - every time the fault message is generated and sent back to XI, the response is correctly corelated with the request message, "WaitResponseBean" and "NotifyResponseBean" are finished correctly and the processing crashes in messaging class on following exception:<br><br>
    java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java:592) at
    com.sap.aii.messaging.mo.MessageContext.setAttribute(MessageContext.java:140) at
    com.sap.aii.adapter.xi.ms.XIMessage.updateHeaders(XIMessage.java:4244) at
    com.sap.aii.adapter.xi.ms.XIMessage.getTransportHeaders(XIMessage.java:570) at
    com.sap.aii.af.ra.ms.impl.ServerConnectionImpl.request(ServerConnectionImpl.java:212) at
    com.sap.aii.af.ra.ms.impl.core.transport.http.MessagingServlet.doPost(MessagingServlet.java:337) at ...
    <br><br>
    Is there anyone, who can put more light on JMS sync/async bridge fault handling ???
    <br><br>
    Thank you ...<br>
    Regards
    Tomas

    Hello again,
    I proceed in investigation little more, but the main problem has not been solved. I found that the problem is not even in WaitResponseBean (placed in JMCReceiverCC). This bean is woken up properly on base of proper CorrelationID. See the log:
    2009-10-15 11:00:33 Success WRB: entering WaitResponseBean
    2009-10-15 11:00:33 Success WRB: retrieving the message for f1ea1fc0-b96d-11de-9b68-00144f4acd86 ...
    2009-10-15 11:00:46 Success WRB: retrieved the message: ApplicationError
    2009-10-15 11:00:46 Success WRB: leaving WaitResponseBean
    I think, that the problem is somewhere within main messaging functionality. I suppose that on base of exception message:
    com.sap.aii.messaging.mo.MessageContext.setAttribute(MessageContext.java:140) at
    which is generated.
    Any ideas or comments ?
    Thank you in advance.
    Regards
    Tomas

  • How to create a generic error handling proxy?

    Hello,
    i have few services proxies.
    I want to create a generic error handling osb proxy which does only errorhandling.
    This proxy would be called by all my services.Now suppose my services proxies would throw any error,the control will pass to error handling block of proxy..from there i will call this generic errorhandling proxyusing a service callout or publish action.In this proxy i want to do all my error handling based on 'n' conditions.and i want to pass the message to the fault variable of services proxy..kindly suggest ways..*main challenge is passing the message to the fault variable of services proxy*

    Hi,
    For generic error handling framework or common error handling framework...create a bpel process which takes the error details payload and sends the inf/data as email to the particular receipients.
    create business process with bpel process and proxy using business service.so wen ever error occurs at stage or route or proxy level ..call error handler action in OSB.Assign error handler details to the bpel input payload.
    FOR EX:
    <soap-env:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <com:test>
    <com:ProcessInfo>testDetails</com:ProcessInfo>
    <com:BusinessProcessName>testprocess</com:BusinessProcessName>
    <com:BusinessProcessInstanceId>{fn-bea:uuid()}</com:BusinessProcessInstanceId>
    <com:BusinessProcessStep>ReqLayer</com:BusinessProcessStep>
    <com:ErrorCode>{string($fault/ctx:errorCode)}</com:ErrorCode>
    <com:ErrorType>Technical</com:ErrorType>
    <com:StatusCode>Error</com:StatusCode>
    <com:ImplementationCode>OSB</com:ImplementationCode>
    <com:ErrorDescription>{string($fault/ctx:reason)}</com:ErrorDescription>
    <com:ErrorDateTime>{fn:current-dateTime()}</com:ErrorDateTime>
    <com:Node>{string($fault/ctx:location/ctx:node)}</com:Node>
    <com:Path>{string($fault/ctx:location/ctx:path)}</com:Path>
    </com:test>
    </soap-env:Body>
    this assign the error details values to the bpel process.

  • Did anyone tried Rejection Message Handler via Queue based method?

    Dear All,
    I am presently doing a Rejected Message Handler process and successfully implemented with File based and Web Service based. But I am not getting the clue for Queue based. We can enqueue the rejected message into queue as a JMS message via this method. But the URI format they have given is *"jdbc:oracle:thin:@<host>:<port>:<sid>#<un>/<pw>#queue"*. Format includes jdbc connection string along with queue name. For this I have created JMS module with JDBC Persistent store and created queue in it. But still I am not able to enqueue the message inside the queue. Also, is there anyway to see the queue names inside the DB. Did anyone tried this method? Could you please share the info??

    WL JMS Queue consume>BPEL1 (One way) invoke>Mediator service (one way) route> BPLE2 (one way). Also I have added transaction properties in BPEL1 and 2 + References + Services.
    Now, if there is a fault in BPEL2 the transaction should be rolled back in BPEL1 and the message should be seen in the WL queue itself. But that is not happening in my case. Everything is getting rolled back upto a point just after the >recieve activity in BPEL1 except the message is not getting rolled back to queue.There will be 2 transactions in this scenario : 1) jms queue to soa hydration store 2) soa-hydration to bpel execution.
    This is the behaviour for 1 way or async interfaces , jms adapter thread completes its transaction work after persisitng to dehydration store and another bpel system thread starts work executing the bpel code after retrieving the message off the db in a separate transaction. So the rollback you are seeing is only applicable for 2nd transaction which roll backs to the dehydration store instead of the queue.
    For synchronous interfaces, the same adapter thread will be involved for complete message processing including bpel code execution. So I think if you want to get the jms queue within the same transaction you can try set up the interfaces to be sync, even with dummy responses. This might make jms adapter thread to start a transaction --> read message off queue within the same transaction --> execute bpel code within same transaction --> complete/rollback transaction based on bpel code execution.

  • Generic Exception Handler/Listener

    All,
    I have a web application and I want to create a generic exception handler/listener which will listen to all the exception(checked and runtime) which are thrown by web application.
    Any idea how can I do this?
    Regards.

    797836 wrote:
    Hi,
    I want to build a generic exception handler which can be reused in any java j2ee applications. Unlikely. Probably impossible.
    I have java application which is communicating with other 3rd party applications like webservices, webmethods , etc from where we are getting an errorcode which will be used in our java application to do a lookup to get the respestive error message from the resource bundle. Please clarify in such case how I can go with a generic exception handler which will be build separately and will be integrated with Java applications to handle the exceptions and errors.An excellent example of why a universal exception handler wouldn't work.
    At some point a call tree looks like A->B->C, where C (or beyond) that is where your communications problem occurs. The impact of that depends on the application.
    For example if a user types in a url (at A) and the server (C) fails to resolve it then that is a user problem.
    However if nightly batch process expects to download an update file every night from one location and it can't connect then that is an operations error (or notification/alert.)

  • Error message handling in BAPI...

    Hi Guys,
    I am working on documentation of a BAPI used SAP insurance module. Now I want to see all the error messages associated/ handled in that BAPI. How can I do that ? Is there a table in data dictionary where I can see error messages handled by a given Function module/ BAPI?
    Any inputs will be highly appreciated.
    Thanks.
    Regards,
    Tushar.

    Hi,
    here´s one possible solution:
      CALL FUNCTION 'MESSAGES_INITIALIZE'.
      LOOP AT it_return_bapi.
        CALL FUNCTION 'MESSAGE_STORE'
             EXPORTING
                  arbgb          = it_return_bapi-id
                  exception_if_not_active = ' '
                  msgty                = it_return_bapi-type
                  msgv1          = it_return_bapi-message_v1
                  msgv2          = it_return_bapi-message_v2
                  msgv3          = it_return_bapi-message_v3
                  msgv4          = it_return_bapi-message_v4
                  txtnr          = it_return_bapi-number
                  zeile          = ' '
             EXCEPTIONS
                  message_type_not_valid  = 1
                  not_active              = 2
                  OTHERS                  = 3.
      ENDLOOP.
      CALL FUNCTION 'MESSAGES_STOP'
           EXCEPTIONS
                a_message = 04
                e_message = 03
                i_message = 02
                w_message = 01.
      IF NOT sy-subrc IS INITIAL.
        CALL FUNCTION 'MESSAGES_SHOW'
             EXPORTING
                  i_use_grid         = 'X'
                  i_amodal_window    = i_amodal_window
             EXCEPTIONS
                  inconsistent_range = 1
                  no_messages        = 2
                  OTHERS             = 3.
      ENDIF.
    ENDFUNCTION.
    Best regards

  • Receiver File adapter - 'Empty Message Handling' option to ignore not worki

    Hi,
      I am trying to create the Files in receiver based on condition.But I am gettiung error in communication channel when there is no payload. Receiver I am usuing FCC and processing tab I selected -'Empty Message Handling' option to ignore .
    one source -> Target 1 (0..1 occurance in signature tab changed, message mapping and operation mapping)
                 and Target 2 (0..1 occurance in signature tab changed)
    and I put the message type level condition. While creating first message If did not create the Message type in my maaping still my Receiver File communication channel is giving error. even thow I my receiver interface occurance is 0..1
    Right now I am in PI7.1 and SP7 is the bug for support pack do I am missing any thing. and do I need to upgrade any nwe patch. appreciate your help.
    Regards,
    Venu.

    Hi,
    here is the my requirment one source -> two target interfacess (0..1)
    If u have 2 target interfaces,then this is not suffice..... u should make it as 0..unbounded both in operation mapping and message mapping.
    But based on ur requirements posted above i guess u have only one inbound interface at a time based on some conditions....
    But,
    <messages>
    <messages1>
    based on condition first message type not created in mapping.
    <messgaes2>
    The error u r getting is because.... u want only one interface in target at a time....
    Then u should not generate Message1 also in the target.
    So avoid mapping to message1 if u want only message2.
    If both message1 and message2 are created in target means... it is triggering for two interfaces.... so avoid one message1 or message2... based on some conditions u have..
    Still nt solved do post...
    Babu

  • Receiver file adapter creates empty files, Empty-Message Handling SP19

    Hello,
    We have just upgraded the system to SP19.
    One of the new features is that it should be possible to determine how XI messages with an empty main payload are to be handled in the receiver file adapter.
    If the parameter Empty-Message Handling is set to 'Ignore' no file should be created if the main payload is empty. In our case an empty file (size 0 kb) is still created even though the main payload is empty and the flag is set to 'Ignore'.
    Has anybody experienced the same problem?
    //  Best regards  Hans

    This should work:
    Use your own adapter module that parses incoming message and checks if it has any record sets in the document. If it does not have any record sets, then set the message to empty and then give this modified message to File receiver.
    For example, see the example code below:
    Module imports..
    Audit log import..
    DOM imports/SAX imports..
    public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException {
              try {
                   // get the XI message from the environment
                   Message msg = (Message) inputModuleData.getPrincipalData();
                   AuditMessageKey amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);
                   Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"RemoveRootTag: Module called");
                   XMLPayload payLoad = msg.getDocument();
                   Document doc = parseXmlFile(payLoad.getInputStream());
                   if(doc != null){
                        if(!doc.getDocumentElement().hasChildNodes()){
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Document is empty!!");
                             payLoad.setContent("".getBytes());
                             msg.setDocument(payLoad);
                   // provide the XI message for returning
                   inputModuleData.setPrincipalData(msg);
                   } catch (Exception e) {
                   // raise exception, when an error occurred
                   ModuleException me = new ModuleException(e);
                   throw me;
                   // return XI message
              return inputModuleData;
         private Document parseXmlFile(InputStream xmlpayload) {
              try {
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   factory.setValidating(false);
                   //        Create the builder and parse the file
                   Document doc = factory.newDocumentBuilder().parse(xmlpayload);
                   return doc;
              } catch (SAXException e) {
              } catch (ParserConfigurationException e) {
              } catch(IOException e){
              return null;

  • MESSAGE HANDLER OF CLASS  if_hrpa_message_handler IS NOT WORKING

    WE HAVE WRITTEN THIS CODE AS BELOWS INSIDE BL BADI....THE ERROR MESSAGE IS GETTTING POPULATED IN THE MESSAGE_LIST BUT DOESN'T GET DISPLAYED WHILE CHECKING AND SENDING THE FORM FROM THE FRONT END.
    THE BELOW CODE IS JUST A SAMPLE CODE IN OUT BADI METHOD THERE ARE SEVERAL VALIDATIONS ON THE FAILURE OF EACH OF THEM A ERROR MESSAGE SHOULD GET TRIGERRED FROM THE FRONT END.MESSAGE_HANDLER IS ALREADY AVAILABLE INSIDE INITIAL COMPUTATIONS SO THERE IS NO REASON TO CREATE OBJECT BADI MESSAGE HANDLER
    [[ IF sy-uname = 'PGOSH' OR SY-UNAME EQ 'CGHOSH'.
       DATA badi_message_handler   TYPE REF TO cl_hrpa_message_list.
         DATA message_handler        TYPE REF TO if_hrpa_message_handler.
         DATA is_ok   TYPE boole_d.
        CREATE OBJECT badi_message_handler.
          message_handler = badi_message_handler.
            message-msgid = 'ZHPA'.
            message-msgty = 'E'.
           message-msgno = '010'.
           message-msgv1 = c_none_plans. "'Invalid Plan'(z09).
             CALL METHOD message_handler->add_message
                EXPORTING
                  message = message
                  cause   = space . "message_handler->ERROR . "infotype_specific . "unknown.
                  is_ok = 'X' ."space.
             badi_message_handler->add_messages( message_handler ).
             RAISE error_with_message.
      ENDIF.]]
    PLS PROVIDE YOUR INPUTS REGATRDING THE REASION WHY THE CODE IS NOT GETTING TRIGERRED.
    Edited by: PRIYANKUSH GHOSH on Jun 18, 2010 4:01 PM

    Moderator message - Welcome to SCN.
    Please do not use all caos in your posts. It makes it hard to read..
    Also, Please read Please read "The Forum Rules of Engagement" before posting!  HOT NEWS!! and How to post code in SCN, and some things NOT to do... and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again.
    Rob

  • Message handling with multiple lines to display

    We have a requirement to issue an error message during dialog processing (PAI) and I'd like to use standard message handling if possible.  The syntax
    MESSAGE W008(ZTM) DISPLAY LIKE 'I'.
    gives me a dialog box but handles the message as an error hence processing stops and the user returns to the screen.  I want this functionality but with the ability to display several lines in the message pop up box.  I've looked at the function modules POPUP_DISPLAY_MESSAGE but this displays only 1 line and POPUP_TO_CONFIRM which handles multiple lines but doesn't stop processing (unless further code is added to handle the response).  Can someone suggest a standard of way of achieving this requirement or how to handle a response as an error in the subsequent processing after a call to function module POPUP_TO_CONFIRM.

    hi,
    you can handle like this.
    call function 'POPUP_TO_CONFIRM'
            exporting
              titlebar                    = text-000
      DIAGNOSE_OBJECT             = ' '
              text_question               = v_text
              text_button_1               = 'YES'
      ICON_BUTTON_1               = ' '
              text_button_2               = 'NO'
      ICON_BUTTON_2               = ' '
              default_button              = '1'
              display_cancel_button       = 'X'
      USERDEFINED_F1_HELP         = ' '
             start_column                 = 25
             start_row                    = 6
      POPUP_TYPE                  =
      IV_QUICKINFO_BUTTON_1       = ' '
      IV_QUICKINFO_BUTTON_2       = ' '
           importing
             answer                      = v_ans
    TABLES
      PARAMETER                   =
           exceptions
             text_not_found              = 1
             others                      = 2
          if sy-subrc <> 0.
            message id sy-msgid type sy-msgty number sy-msgno
                    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          endif.
          case v_ans.
            when '1'.
              leave program.
            when '2'.
              call screen 100.
            when others.
              call screen 100.
          endcase.
      endcase.
    Here : 1 means yes,
              2 means no.
    Regards
    Sandeep Reddy

  • Advantages of Using Queued Message Handler vs. Standard State Machine

    Hello,
    What are the advantages of using a Queued Message Handler?  Also, why are they more powerful than using Standard State Machines?
    Thanks!

    They are really just sort of an extension of a state machine.  The general idea is that you have one loop doing a specific job.  You then use a queue to tell it how/when to do this job.  For instance, I might have a log file loop.  I will send it commands to open a file, write some data, write some more data, and finally close the file.  Each of those commands are coming from the queue.  The beauty with this setup is that anybody that can get a reference to that queue can send the command to that loop.
    So the QMH is "better" than a state machine mostly because of the decoupling of functions.  In a given application, I will have a loop for log file writing, GUI updates, reading of a DAQ, instrumenet communications, server communications, etc.  Trying to do all of that in a single loop state machine is a major pain in the rear end.  Seperating them out makes life so much easier.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Empty-Message Handling is not working in receievr File Adapter

    Hi All,
    I have selected "Empty-Message Handling" = 'Ignore'in Receiver File adapter, but still empty files are creating in target directory.
    Message mapping generates output based on the conditon, if the condition is 'false' mapping will generate empty file (no data is being mapped).
    Why Receiver file adapter is processing empty fiels even i set 'ignore' empty fiels in configuration (ID)?
    Hoe can i manage not to place empty fiels in target directory?
    File type is '.txt'
    Your help would be appreiciated greatly.
    Thanks,
    Rajesh

    Not sure why is it not working. Make sure the channel is activated and cache is refreshed properly. But as a workaround you may use OS script checking for size of message and deleting it or configure a BPM to avoid the file creation. Or else an adapter module as shown
    /people/gowtham.kuchipudi2/blog/2006/01/13/stop-creation-of-an-empty-file-from-file-adapter-using-module
    Regards,
    Prateek

Maybe you are looking for