7 Replies Latest reply on Apr 16, 2010 4:26 AM by valdar

    is NMR a multithreaded endpoints

    lekkie_lomotayo

      I was just wondering if the NMR endpointis multithreaded.

       

      And when I say multithreaded, here is what I mean.

       

       

       

       

      My question is if camelcontext 'somewhere' has sent a request to nmr:myDynamicRouter and it is waiting for a response, then camelcontext 'anotherSomewhere' sends its request to nmr:myDynamicRouter (note that the dynamicRouter is still processing initial request from camelContext 'somewhere'); will this make nmr:myDynamicRouter block (on anotherSomewhere's camelContext)?

       

      How can I guaranty that nmr:myDynamicRouter will be able to handle multiple request from different endpoints simultaneously without blocking?

       

      kr.

        • 1. Re: is NMR a multithreaded endpoints
          njiang

          Hi ,

           

          There is a thread pool in the NMR to deal with the message, and camel-nmr consumer just leverage the NMR thread pool to do its daily job.

           

          So my answer is the multiple request to nmr:myDynamicRouter endpoint can be handled parallelly.

          • 2. Re: is NMR a multithreaded endpoints
            valdar

            Mmm, are you sure?

            I have this route deployed in FUSE esb 4.2:

             

            JETTY -> CXF with NMR address

             

            if I send multiple requests to the jetty url they are served 1 by 1.

            If I expose CXF service directly on an url address multiple requests are served at the same time.

             

            So I think that the NRM endpoints are not multithreaded "out of the box".

            Do I need to activate this behavior in some configuration file?

             

            Andrea.

            • 3. Re: is NMR a multithreaded endpoints
              lekkie_lomotayo

              My exact sentiment. This is because I have tested this and it seems to use a single thread which blocks incoming requests.

               

              Here is my test

               

              E

               

              Where

              (A) nmr:consumer

              (B) router1

              (C) nmr:processor

              (D) router1

              (E) nmr:provider

               

              When it gets to D, the system blocks and throw timeout exception, because it is waiting for B to end. Of course it will never end until this flow returns.

               

              Edited by: lekkie on Apr 15, 2010 7:41 AM

               

              Edited by: lekkie on Apr 16, 2010 7:56 AM

              • 4. Re: is NMR a multithreaded endpoints
                njiang

                Can I have a look at your Jetty and NMR route?

                Are you using the Jetty as a proxy to send the request to the CXF ?

                 

                camel-jetty endpoint support the server the multi request at the same time.

                • 5. Re: is NMR a multithreaded endpoints
                  njiang

                  How did you send the request to "nmr:consumer" ?

                  If you just use the client.sendSync(e) to send the request in a loop, the camel route will server the request one by one.

                  • 6. Re: is NMR a multithreaded endpoints
                    lekkie_lomotayo

                    The camel snippet below calls the nmr:consumer.

                     

                     

                    • 7. Re: is NMR a multithreaded endpoints
                      valdar

                      This is the definition of the jaxws endpoint:

                         <jaxws:endpoint id="cxfNMRService"
                                         implementor="xx.yyy.zzz.CxfNmrService"
                                         address="nmr:cxfNMR" />
                      

                       

                      and this is the route:

                      from("jetty:http://0.0.0.0:8390/xxx/yy?matchOnUriPrefix=true")
                             //logging stuff        
                             .beanRef("myTx", "log")
                             
                             //call to the CXF endpoind on the NMR
                             .to("nmr:cxfNMR")
                             
                             //logging stuff 
                             .beanRef("myTx", "log");