Forum Discussion

vijaydi's avatar
vijaydi
Contributor
8 years ago

JMS Mock - Extract Header Value from Incoming request and set in the JMS dispatch response property.

Hi, 

 

I have a mock implementation of JMS message. I am trying to  capture custom header value from the incoming request into the mock and set that value in the response header of the mock response before dispatching it.

 

Tried the below line of code. Works well for HTTP mock requests but not for  JMS messages coming into the mock.

 

 
def Host= mockRequest.getRequest().getHeader("Host").toString()
log.info(Host)

 

Would really appreciate if you someone could shed some light on it.

 

Thanks

 

  • nmrao's avatar
    nmrao
    8 years ago

    vijaydi

    Since that is a jms message, you can give a try below:

    //If works, then it should fetch the value of SubscriberId property

     

    log.info mockRequest.message.getStringProperty('SubscriberId')

    • vijaydi's avatar
      vijaydi
      Contributor

      hi Rao,

       

      the queues are configured in hermesJMS.

       

      In service V, a JMS virt was created and the JMS route, specifying  hermes config, session and target was added.

       

      please find below screenshot of the this implementation in  servive V. 

       

       

       

      • vijaydi's avatar
        vijaydi
        Contributor

        the below is a snapshot of the transaction log, with incoming messages. 

         

        I have highlighted the JMS property values which I would like to capture in the incoming request  and set in the response message.