Service Virtualization

 View Only
Expand all | Collapse all

Multiple VS listening on same Queue

  • 1.  Multiple VS listening on same Queue

    Posted Sep 21, 2018 09:00 AM
      |   view attached

    Note: Virtual Service created using IBM MQ Native protocol

     

    I have multiple VS listening on same PROXY Request Queue. Based on payment Type dropping on Request Queue - specific VS should pick the request and respond back with virtual response on PROXY Response Queue.

     

    Could you please all help me with code or vsm step or specific assertion needs to be done to achieve this?

     

    Expectation: 

    • Based on request tag if paymentMethod = NEFT, than VS-NEFT should pick the request from Queue, if paymentMethod  = RTGS, than VS-RTGS should pick the request from queue, likewise for others too.

     

    PFA - Attached ReqXML

     

     

    Attachment(s)

    zip
    SampleReq-req.xml.zip   417 B 1 version


  • 2.  Re: Multiple VS listening on same Queue

    Posted Sep 21, 2018 09:07 AM

    If message header contains unique value you can use message selector



  • 3.  Re: Multiple VS listening on same Queue

    Posted Sep 21, 2018 09:10 AM

    Hi Steven,

     

    I have checked with the Team and the message header doesn't contain any unique value. The unique value to identify the payment method is inside message body. Anything we can do for this?



  • 4.  Re: Multiple VS listening on same Queue

    Posted Sep 21, 2018 09:17 AM

    Could have one proxy MQ VS, depending on type would make call to downstream payment type HTTP VS



  • 5.  Re: Multiple VS listening on same Queue

    Posted Sep 21, 2018 09:21 AM

    Steve, the downstream side is MQ too. And if we club all payment type in Single VS, changing mode to Most efficient or Live will affect all the payment types.



  • 6.  Re: Multiple VS listening on same Queue

    Posted Sep 21, 2018 09:26 AM

    The HTTP VS is only simulating the response message your MQ VS would still handle the routing of proxy or live queues



  • 7.  Re: Multiple VS listening on same Queue

    Posted Sep 21, 2018 09:29 AM

    Hi Steven,

     

    Could you please show me the example?



  • 8.  Re: Multiple VS listening on same Queue

    Posted Sep 21, 2018 10:16 AM
      |   view attached

    Attached should give you an idea, new version would need to make use of native mode instead of deprecated.

    Attachment(s)

    zip
    ProxySelector.zip   146 KB 1 version


  • 9.  Re: Multiple VS listening on same Queue

    Broadcom Employee
    Posted Sep 21, 2018 09:45 AM

    Hi Pranay

                I tend to believe that this is possible. Please follow the directions provided in the screenshot below. Basically you need to Edit the PROXY REQUEST queue definition by modifying the default JMS consumer. By defining a message selector, only specific messages meant for the VSE would be read. The message selector uses standard JMS syntax. I havent tried it myself, but I think you should be able to figure it out. Please let me know if it works.

     

     

    regards

    Sankar



  • 10.  Re: Multiple VS listening on same Queue
    Best Answer

    Broadcom Employee
    Posted Sep 21, 2018 10:05 AM

    Hi Sankar --

     

    If I understand Pranay's problem right, they would like to use message selector, but JMS message selectors only work against message properties, and the piece of uniqueness in the message is embedded inside the message payload.

     

    This means that the virtual service has to select and open the message to determine whether the message is for itself. By that time, it's already too late to use message selectors.

     

    So we need a virtual service to open the message and perform actions against it. This is a proxy virtual service, as Steve suggested. To make sure it conforms to Pranay's further requirements, I think there needs to be a second request proxy queue.

     

    The proxy virtual service will open and read the message, storing the value of paymentMethod. It would then write the value of paymentMethod to a JMS header property and forward the entire request to the second request proxy queue.

    Each of the virtual services that do different things depending on the value of paymentMethod would be listening to the second request proxy queue, and they would use message selectors against the JMS property that now contains the value of paymentMethod.

     

    Rick



  • 11.  Re: Multiple VS listening on same Queue

    Broadcom Employee
    Posted Sep 21, 2018 12:22 PM

    You are right Rick. JMS message selectors work only on header and properties. Thanks for the clarification. The definition of JMS as I found from Java website.

     

    "The message consumer then receives only messages whose headers and properties match the selector. (See Message Headers, and Message Properties.) A message selector cannot select messages on the basis of the content of the message body."



  • 12.  Re: Multiple VS listening on same Queue

    Posted Sep 24, 2018 06:37 AM

    Hi Rick.Brown howst04

     

    Please correct me, if I understood incorrectly.

     

    So, I have to create:

    • As per diagram, I attached - Have two crate additional PROXY request Queue?
    • Proxy Virtual Service which listens all the request drops in PROXY.PAY.REQUEST and creates paymentMethod as property and stores it value. Should Proxy Virtual Service needs to be HTTP/HTTPS?
    •  The same Proxy VS then drops the entire request which it listened to another PROXY REQUEST QUEUE (I guess, additional one apart from PROXY.PAY.REQUEST) with additional JMS header property as paymentMethod - so that VS-IMPS (if paymentMethod = IMPS) can pick the message.

     

    If my understanding is correct, I would require your help in knowing how to create VSI/VSM for this.



  • 13.  Re: Multiple VS listening on same Queue

    Posted Sep 24, 2018 07:32 AM

    Please refer to message selector VS shared



  • 14.  Re: Multiple VS listening on same Queue

    Posted Sep 25, 2018 07:17 AM

    Hi Steven,

     

    Looking to VS shared - Is the MQ points to HTTP VS for fetching response and sending back to Response Queue. If yes - Changing the MQ VS mode to Live or to Virtual mode will affect all paymentMethod right?



  • 15.  Re: Multiple VS listening on same Queue

    Posted Sep 25, 2018 07:28 AM

    The project shared was for reference you would need to edit to fit your use case



  • 16.  Re: Multiple VS listening on same Queue

    Posted Sep 25, 2018 07:15 AM

    Hi Rick,

    For the Proxy VS - I guess we have to create another proxy queue which first extracts the request from Queue and extracts the paymentMethod value. And re-transfer the request to another proxy Queue with JMS header property.

     

    If my understanding is correct - Could you let me know how to pass the paymentMethod as JMS header property along with original request?