RE: Dynamically configure broker

View: New views
3 Messages — Rating Filter:   Alert me  

RE: Dynamically configure broker

by dbell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jenny,

It may not be as elegant but you can always use a coded broker, it's as
simple as extending org.apache.activemq.broker.BrokerService and then
calling addConnector with the dynamic broker URL.

Hope this helps,

- Doug

-----Original Message-----
From: Jenny wei [mailto:jia_wei@...]
Sent: Thursday, November 16, 2006 5:11 PM
To: user@...
Subject: [SPAM] - [lingo-user] Dynamically configure broker - Email
found in subject


Hi,

   In the Lingo example file, I saw:

   <!-- JMS ConnectionFactory to use -->
  <bean id="jmsFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="vm://localhost"/>
  </bean>

   I wonder if there is a way to dynamically configure broker. My
application client could potentially connect to different servers, after
a user chooses one, it will use the service provided by the specified
server.
So the hardcoded broker URL will not work.  For different customers,
they will use different server set up. Again, the hardcoded broker URL
will not work.

   Thanks,

   Jenny
--
View this message in context:
http://www.nabble.com/Dynamically-configure-broker-tf2648873.html#a73920
74
Sent from the lingo - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Dynamically configure broker

by James.Strachan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Agreed. Or you could use the failover URI syntax to provide a list of
possible servers which if they are available will be used otherwise
the next one will be used etc.

http://incubator.apache.org/activemq/failover-transport-reference.html

On 11/30/06, Bell, Douglas <DBell@...> wrote:

> Hi Jenny,
>
> It may not be as elegant but you can always use a coded broker, it's as
> simple as extending org.apache.activemq.broker.BrokerService and then
> calling addConnector with the dynamic broker URL.
>
> Hope this helps,
>
> - Doug
>
> -----Original Message-----
> From: Jenny wei [mailto:jia_wei@...]
> Sent: Thursday, November 16, 2006 5:11 PM
> To: user@...
> Subject: [SPAM] - [lingo-user] Dynamically configure broker - Email
> found in subject
>
>
> Hi,
>
>    In the Lingo example file, I saw:
>
>    <!-- JMS ConnectionFactory to use -->
>   <bean id="jmsFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
>     <property name="brokerURL" value="vm://localhost"/>
>   </bean>
>
>    I wonder if there is a way to dynamically configure broker. My
> application client could potentially connect to different servers, after
> a user chooses one, it will use the service provided by the specified
> server.
> So the hardcoded broker URL will not work.  For different customers,
> they will use different server set up. Again, the hardcoded broker URL
> will not work.
>
>    Thanks,
>
>    Jenny
> --
> View this message in context:
> http://www.nabble.com/Dynamically-configure-broker-tf2648873.html#a73920
> 74
> Sent from the lingo - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--

James
-------
http://radio.weblogs.com/0112098/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Dynamically configure broker

by Sanjiv Jivan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jenny,
Here's what I do :

I have a Spring context with just the beans related to file the configuration of the Lingo broker / proxy. In this file I have the broker url parameretized :

<beans>

    <!-- JMS ConnectionFactory to use -->
    <bean id="jmsFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="${ broker.url}"/>
    </bean>

    <bean id="myService" class="org.logicblaze.lingo.jms.JmsProxyFactoryBean">
       ....
    </bean>

    <bean id="myDestination" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg index="0" value="myQ"/>
    </bean>

    <bean id="invocationFactory" class=" org.logicblaze.lingo.LingoRemoteInvocationFactory">
       ..
    </bean>
    ...
</beans>

In my application where I need a reference to "myService" with a particular broker configuration, I read the "myService" bean as follows :

        XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("/com/foo/client/lingoContext.xml"));

        PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
        Properties p = new Properties();
        p.setProperty("broker.url", <your broker url>);
        cfg.setProperties(p);
        cfg.postProcessBeanFactory(factory);
        MyService myService = (MyService) factory.getBean("myService");


I use this technique primarily in a test UI that I created where I can enter a url and carry out some tests. In my real application, the broker url is setup during configuration time.

Sanjiv


On 12/1/06, James Strachan <james.strachan@...> wrote:
Agreed. Or you could use the failover URI syntax to provide a list of
possible servers which if they are available will be used otherwise
the next one will be used etc.

http://incubator.apache.org/activemq/failover-transport-reference.html

On 11/30/06, Bell, Douglas <DBell@...> wrote:

> Hi Jenny,
>
> It may not be as elegant but you can always use a coded broker, it's as
> simple as extending org.apache.activemq.broker.BrokerService and then
> calling addConnector with the dynamic broker URL.
>
> Hope this helps,
>
> - Doug
>
> -----Original Message-----
> From: Jenny wei [mailto:jia_wei@...]
> Sent: Thursday, November 16, 2006 5:11 PM
> To: user@...
> Subject: [SPAM] - [lingo-user] Dynamically configure broker - Email
> found in subject
>
>
> Hi,
>
>    In the Lingo example file, I saw:
>
>    <!-- JMS ConnectionFactory to use -->
>   <bean id="jmsFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
>     <property name="brokerURL" value="vm://localhost"/>
>   </bean>
>
>    I wonder if there is a way to dynamically configure broker. My
> application client could potentially connect to different servers, after
> a user chooses one, it will use the service provided by the specified
> server.
> So the hardcoded broker URL will not work.  For different customers,
> they will use different server set up. Again, the hardcoded broker URL
> will not work.
>
>    Thanks,
>
>    Jenny
> --
> View this message in context:
> http://www.nabble.com/Dynamically-configure-broker-tf2648873.html#a73920
> 74
> Sent from the lingo - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--

James
-------
http://radio.weblogs.com/0112098/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


LightInTheBox - Buy quality products at wholesale price