7 Replies Latest reply on Nov 13, 2013 7:21 AM by jduro

    How to add new topics to JCA binding programmatically

    jduro

      Hi guys,

       

      Imagine a scenario where I have a service listening to a JCA binding which is using Activemq in a specific topic/destination (ex: "defaultTopic").

      After the deploy I want to be able to add topics/destinations dynamically (ex: have a RESTeasy binding that will add topics or destinations to the JCA binding) to that binding (ex: "TopicA", "TopicB", etc.). These new topics/destinations will then be redirected to a previously defined service.

       

      The question is, how can I add these new topics dynamically?

      How can I associate these new topics to a service?

      And how can I know in which topic was the message received in the service?

        • 1. Re: How to add new topics to JCA binding programmatically
          igarashitm

          Hi João,

           

          JCA inbound activates its endpoint at deployment time, so the destination can't be changed/added. If you really want to do that, you may need to deploy a new SwitchYard application. JCA outbound also doesn't support multiple destination with the default JMSProcessor, but you can implement your own processor instead of using default one.

           

          This is the default JMS outbound processor:

          https://github.com/jboss-switchyard/components/blob/master/jca/src/main/java/org/switchyard/component/jca/processor/JMSP…

           

          Thanks,

          Tomo

          1 of 1 people found this helpful
          • 2. Re: How to add new topics to JCA binding programmatically
            jduro

            Thanks Tomo,

             

            But how can I preform such functionality?

            I'm using MQTT protocol and I want to make use of Topics to implement a Publish/Subscribe method to allow new clients to communicate with the Switchyard platform..

             

            I'm still new to the Switchyard, so my knowledge is limited in this domain..

             

            Cheers,

            João Duro

            • 3. Re: How to add new topics to JCA binding programmatically
              igarashitm

              Are you asking how to deploy a new SwitchYard application programatically? I'm sorry but I don't think it can be achieved in a reasonable way...

              • 4. Re: How to add new topics to JCA binding programmatically
                jduro

                No, I was asking if there isn't any other way of implementing a solution to this problem..

                 

                Isn't there a way to implement a publish/subscribe messaging method in switchyard?

                • 5. Re: How to add new topics to JCA binding programmatically
                  igarashitm

                  I don't think it's possible with existing SwitchYard bindings for now, however, you can implement your own binding, it's not that handy though. You will need to understand internal architecture of the SwitchYard component, configuration model, etc.

                   

                  Beyond that, I personally think it's worthy to consider if ad hoc service/reference registration helps users, but it definitely need much deeper surgery and there're a lot of things to discuss, so it won't come before SwitchYard 2.x at the earliest even if we decide to do it today.

                   

                  Of course your contribution to SwitchYard is always very welcome! If you have a nice idea to implement it on SwitchYard in a generic way, that would be super awesome

                   

                  Thanks,

                  Tomo

                  1 of 1 people found this helpful
                  • 6. Re: How to add new topics to JCA binding programmatically
                    kcbabo

                    Have you considered an approach where you configure SwitchYard to consume from a single destination and then use ActiveMQ configuration to forward from the dynamic 'edge' destinations (these would be the MQTT client destinations) to the destination that SwitchYard is consuming from?  It appears as though ActiveMQ supports something like this through destination interceptors, although I must admit I'm not an expert on ActiveMQ or its support for MQTT.  My main point, however, is that SwitchYard can support this type of architecture if the message multiplexing happens in the broker (which seems like the right place to me).

                    • 7. Re: How to add new topics to JCA binding programmatically
                      jduro

                      Thanks guys,

                       

                      This final answer by Keith Babo looks like the best approach to this issue.

                      Throwing the multiplexing away from the Switchard to a ActiveMQ broker, that will receive the MQTT messages and then activating the workflow (service) in the Switchyard by means of a predefined binding (such as REST).

                       

                      These answers have helped me a lot, and thanks again for being so quick to answer this post.

                      If you could find better solutions to this problem, let me know, so that we can discuss them .

                       

                      Cheers,

                      João Duro