4 Replies Latest reply on Oct 23, 2015 9:34 AM by Valery Sedykh

    How to proper configure and deploy a broker to Fuse

    Tiago Matias Newbie

      Hello,

       

      I'm trying to create and deploy a broker to Fuse 6.2 but since I've only recently started learning Fuse I'm quite confused about the way to go.

       

      My objective is "simple":

           1) Create a master-slave broker

           2) Create a Queue

           3) Send messages from a Spring-MVC app running on Widlfy

           4) Use a camel route to load messages from the queue and do some processing.

       

      With the help of Christina Lin's excelent tutorial (avaliable here: Christina の J老闆 : Red Hat JBoss Fuse - Sending message to queue in ActiveMQ via Camel) I managed to sort out points 1) to 3) by manually creating a broker, a queue on the web interface.

       

      My issue is with the configuration of the broker because it appears that the URL's TCP/IP port is constantly changing. Currently I have this configuration:

       

      <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">

              <property name="brokerURL" value="tcp://MEGA:53252" />

              <property name="userName" value="admin"></property>

              <property name="password" value="admin"></property>

              <property name="redeliveryPolicy">

                  <bean class="org.apache.activemq.RedeliveryPolicy">

                      <property name="maximumRedeliveries" value="4" />

                  </bean>

              </property>

          </bean>

          <bean id="cachingConnectionFactory"

              class="org.springframework.jms.connection.CachingConnectionFactory">

              <property name="targetConnectionFactory" ref="connectionFactory" />

          </bean>

          <bean id="syncTestQueue" class="org.apache.activemq.command.ActiveMQQueue">

              <constructor-arg value="mqQuestionnaireProcessor" />

          </bean>

          <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">

              <property name="connectionFactory" ref="cachingConnectionFactory" />

              <property name="defaultDestination" ref="syncTestQueue" />

              <property name="sessionTransacted" value="true"></property>

          </bean>

       

      Which doesn't appear to be very correct as if I have multiple broker instances deployed on the fabric (and a master-slave broker already has 2 possible containers) the IP:Port cannot be hardcoded. Aditionnaly I have two machines (home and work) and it would be nice if my web application runs on both without changing config files.

       

      So I started to search and it appears that what I should do is:

      1) Create a profile (as a file, not on fuse's web interface)

      2) Configure a broker and it's queues with the profile

      3) Make sure the configuration between the client and broker is HOST/IP agnostic.

      4) deploy that profile on the fabric.

       

      But I'm quite confused on how to achieve this (Assuming it's possible). Can someone point me into the right direction? Some tutorials perhaps?

       

      Many thanks!