5 Replies Latest reply on Apr 21, 2008 10:51 AM by Kevin Conner

    Sending messages in Request/Response mode

    marilyn kol Newbie

      Hi,

      I am using JBoss ESB associated to JBPM. I want to send messages to ESB from the JBPM by using a Request/Response mode.
      My problem is that i am not getting correctly the response. I am often having as result a MessageDeliveryException due to Unresponsive EPR. After taking a look in the ESB source code, i have noticed that when the pickup method done on the answer EPR is returning null, we have an unresponsive EPR.

      I correctly fill in my message header the To and ReplyTo attributs. This is an extraction of my configuration in the jboss-esb.xml. This is an example sending message to Ldap for a user creation, i am waiting for a response to continue the treatment.

      I am not really sure of my used method to configure the response service, so someone has already done that, advice can be useful

      service category="CreateUser" name="CreateUserLDAPRequest"
      description="Received message to create user with LDAP">
      <listeners>
      <jms-listener name="JMS-ESBListener"
      busidref="RequestCreateUserLDAPEsbChannel"
      maxThreads="1"
      />
      </listeners>
      actions mep="RequestResponse">
      action name="sendToLDAP" class="fr.gouv.defense.ltoboa.common.esb.DelegateSpringListener"
      process="delegate">
      <property name="strict" value="true" />
      <property name="methodName" value="createUser" />
      <property name="applicationContext" value="userApplicationContext.xml" />
      <property name="beanName" value="ltoboa-ldap.esb.processor" />
      <property name="ignoreException" value="true" />
      </action>
      service category="CreateUser"
      name="CreateUserLDAPResponse"
      description="Sent response message to create user with LDAP" >
      <listeners>

      <jms-listener name="JMS-ESBListener"
      busidref="ResponseCreateUserLDAPEsbChannel"
      maxThreads="1"
      />
      </listeners>
      actions mep="OneWay">
      action name="printlnRetour"
      class="org.jboss.soa.esb.actions.SystemPrintln"
      />
      </actions>
      </service>


      henry


        • 1. Re: Sending messages in Request/Response mode
          Kevin Conner Master

          We would really need some more information about your application before we could identify any issues. The Unresponsive EPR is normally caused by a service timing out on a synchronous invocation and there may be a number of causes.

          One of the things I would like to point out is that we have rewritten the jBPM/ESB integration and this has now made its way back into trunk (it was previously available in our CP branch). This integration is much cleaner (and simpler) than the original and uses asynchronous messaging under the covers. This has many advantages over the original, for example better performance, no blocking of threads, the ability to use transactions, message redelivery etc.

          We will be releasing the next version of the project within the next few weeks (see the development forum for the dates).

          Kev

          • 2. Re: Sending messages in Request/Response mode
            marilyn kol Newbie

            Thank you for your answer. So about more details :

            We developped our own EsbRequestResponse client to send message to the ESB. This client is used in a jbpm handler to send the message initialized in others steps.

            This is the code line added in the jbpm handler (So waiting for a response) :

            // Send the message
            Message response = esbClient.send(request);


            esbClient is an EsbRequestResponseClient (Created by us). Here is the code of the method send used in the handler

            ServiceInvoker invoker;
            try {
            invoker = getInvoker(message);
            } catch (MessageDeliverException e) {
            throw new StandardRuntimeException(CodeTypeEvenement.COMMUN_ESB_TRANSFERT, "message=" + message, e);
            }
            URI messageId = message.getHeader().getCall().getMessageID();
            if (messageId == null) {
            try {
            messageId = new URI(UUID.randomUUID().toString());
            LOG.debug(" Warning, the message.header.call.messageId was NULL, random generated value added " + messageId);
            message.getHeader().getCall().setMessageID(messageId);
            } catch (URISyntaxException e) {
            throw new StandardRuntimeException(CodeTypeEvenement.COMMON_ESB_MISSING_MESSAGE_ID, " Automatic MessageId generator failed messageId=" + messageId, e);
            }

            }
            URI uri = message.getHeader().getCall().getAction();
            if (uri == null) {
            LOG.debug("Warning, Action Missing");
            String uriString = "urn:" + destination.getCategory()+ ":" + destination.getName();
            try {
            uri = new URI(uriString);
            } catch (URISyntaxException e) {
            throw new StandardRuntimeException(CodeTypeEvenement.COMMON_ESB_MISSING_OR_BAD_URI, "Error while parsing " + uriString, e);
            }
            message.getHeader().getCall().setAction(uri);
            }
            Message messageResponse = null;
            if (LOG.isDebugEnabled()) LOG.debug("Send Message" + message);


            try {
            messageResponse = invoker.deliverSync(message, responseTimeoutInMillis);
            } catch (MessageDeliverException e) {
            throw new StandardRuntimeException(CodeTypeEvenement.COMMUN_ESB_TRANSFERT, "invoker=" + invoker + ",message=" + message, e);
            } catch (FaultMessageException e) {
            throw new StandardRuntimeException(CodeTypeEvenement.COMMUN_ESB_TRANSFERT, "invoker=" + invoker + ",message=" + message, e);
            } catch (RegistryException e) {
            throw new StandardRuntimeException(CodeTypeEvenement.COMMUN_ESB_TRANSFERT, "invoker=" + invoker + ",message=" + message, e);
            }
            //}
            if (LOG.isDebugEnabled()) LOG.debug("Request/Response:" + messageResponse);
            return messageResponse;
            }


            So we are in the case of the caught of the exception MessageDeliveryException.

            We are using the ServiceInvoker to create an invoker where it is set the destination. In the method getInvoker, we are setting correctly the message header :

            Here is the getInvoker code :

            LOG.debug("Make Invoker");
            ServiceInvoker invoker = new ServiceInvoker(destination);
            Call call = messageToSend.getHeader().getCall();
            EPR replyToEpr = getServiceEPR(replyTo);
            EPR sourceEpr = getServiceEPR(source);
            EPR errorToEpr = getServiceEPR(errorTo);
            EPR to = getServiceEPR(destination);
            call.setTo(to);
            call.setFrom(sourceEpr);
            call.setReplyTo(replyToEpr);
            call.setFaultTo(errorToEpr);
            return invoker;


            I hope that I gave you enough details. Otherwise, tell me the sort of needed information to help you to understand my problem

            Thanks you

            henry

            • 3. Re: Sending messages in Request/Response mode
              Kevin Conner Master

              The best way would be for you to send the server.log file so that I can see what is happening in your deployment. Would this be possible? Could you email it to me?

              Thanks,
              Kev

              • 4. Re: Sending messages in Request/Response mode
                marilyn kol Newbie

                I have just sent the log by email. You must received it, sent by henri.gueye@capgemini.com or hgueye@capgemini.fr.

                Thanks,

                • 5. Re: Sending messages in Request/Response mode
                  Kevin Conner Master

                  Thanks, it has just arrived. I will get back to you as soon as I can.

                  Kev