Announcement Announcement Module
Collapse
No announcement yet.
Intercept the JMSMessage before sending it? pairing up clients and service instances. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Intercept the JMSMessage before sending it? pairing up clients and service instances.

    Hi all,

    I'm trying to figure out if the scenario in the title is even possible?
    The reason i'm asking is the following:
    1. We have multiple service clients - all SpringWS implementation
    2. We have multiple service instances running on the same request/response QUEUES, but on different machines.
    3. We want only some clients to be able to invoke some service instances....

    My idea is to use JMS messageSelectors for filtering, which is possible on the DMLC (server side) but i'm lacking a mechanism which would enable us to set the custom header property on a JMS message on the client.

    Any best practices with these kind of scenarios?

    Thanks in advance!

  • #2
    You can get a reference to the request message by using the TransportContext. See http://static.springframework.org/sp...nsport-context, both on client (in a callback) and on server.

    Cast the connection to a JmsSenderConnection, and get the messages from there.

    Let me know if that works for you

    Comment


    • #3
      Sorry...

      ...I should have read the docs more carefully - i wouldn't have missed the part you pointed out....
      Off course it works, like a charm. This is the missing piece in our multi-instance clients and services development setup...

      Thanks!

      Comment


      • #4
        Ooops...

        ...seems that the Message retrieved via the TransportContext returns back as NULL...

        Which leads to NPE when trying to mess around with the Message....I'll try to investigate a bit...
        Sorry for the hassle...

        Comment


        • #5
          It seems...

          ...that the
          Code:
          Callback.doWithMessage
          executes before
          Code:
          JmsSenderConnection.onSendBeforeWrite
          which is the method that actually creates the
          Code:
          javax.jms.Message
          Could the creation of the Message be dealt with earlier in the execution chain?

          Thanks in advance!

          Comment


          • #6
            Originally posted by miha View Post
            Could the creation of the Message be dealt with earlier in the execution chain?
            Yes, I have created http://jira.springframework.org/browse/SWS-311 to fix this.

            Comment


            • #7
              I've playing around with the JmsSenderConnection class, would you mind if i attached my temp solution to the JIRA issue you created?

              Comment


              • #8
                It's fixed. If my solution is different than what you had in mind, I'm all ears .

                Comment


                • #9
                  I'm sure that your solution is the proper one

                  ...until it becomes available in a 1.5 snapshot or in the final release, we'll be using our own

                  Thank you very much for such a quick reaction!

                  P.S. Our patch is just a bit different, i would appreciate if you took the time to look at our solution (in the attached archive) and comment it..And point out the errors of our way
                  Last edited by miha; Mar 14th, 2008, 04:46 AM.

                  Comment

                  Working...
                  X