You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Mohit Anchlia <mo...@gmail.com> on 2011/09/28 23:05:54 UTC

Understanding basic config

I have this config. Trying to understand few things:

1. what's the different between uri="tcp://localhost:0" and
brokerURL="vm://localhost" ?
2. In point 1 why are both not tcp?
3. what is :0? That doesn't look like a port to me. Is this specifial
for embedded broker?



 <amq:broker useJmx="false" persistent="false">
    <amq:transportConnectors>
      <amq:transportConnector uri="tcp://localhost:0" />
    </amq:transportConnectors>
  </amq:broker>

   <!--  ActiveMQ destinations to use  -->
  <amq:queue id="destination"
physicalName="org.apache.activemq.spring.Test.spring.embedded"/>

  <!-- JMS ConnectionFactory to use, configuring the embedded broker
using XML -->
  <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>

Re: Understanding basic config

Posted by Marcelo Jabali <mj...@fusesource.com>.
Because you are basically mixing two different approaches where clients running on the same JVM take the advantage of connecting to local brokers and remote clients connect to the broker using the regular TCP approach.

There are additional references available here: http://activemq.apache.org/configuring-transports.html



On Oct 1, 2011, at 10:31 AM, Mohit Anchlia wrote:

> On Sat, Oct 1, 2011 at 12:06 AM, Marcelo Jabali <mj...@fusesource.com> wrote:
>> Mohit,
>> 
>> ActiveMQ has several transport protocols available (connection URLs for a client to connect to a broker).
>> TCP - is used when clients connect to the broker using a TCP socket. VM - is used when you are embedding the broker in your app (client and broker running on the same JVM) and you want to take the performance benefits of connecting the clients to the broker without hitting the network layer. Everything goes through in-memory buffers.
>> 
>> Hope this helps,
> 
> That I understand but still not clear about why broker and the factor
> are different? Why would broker listen on tcp if client is using vm
> call?
> 
> <amq:broker id="BridgeBroker" useJmx="true" persistent="false">
> 
>   <amq:transportConnectors>
>     <amq:transportConnector uri="tcp://localhost:0" />
>   </amq:transportConnectors>
> </amq:broker>
> 
> 
> <!-- JMS ConnectionFactory to use, configuring the embedded broker
> using XML -->
> 
> <amq:connectionFactory id="BridgeJmsFactory" brokerURL="vm://bridgehost"/>
> 
>> 
>> -Marcelo
>> 
>> 
>> On Sep 28, 2011, at 4:18 PM, Mohit Anchlia wrote:
>> 
>>> On Wed, Sep 28, 2011 at 3:33 PM, Timothy Bish <ta...@gmail.com> wrote:
>>>> On Wed, 2011-09-28 at 14:05 -0700, Mohit Anchlia wrote:
>>>>> I have this config. Trying to understand few things:
>>>>> 
>>>>> 1. what's the different between uri="tcp://localhost:0" and
>>>>> brokerURL="vm://localhost" ?
>>>>> 2. In point 1 why are both not tcp?
>>>>> 3. what is :0? That doesn't look like a port to me. Is this specifial
>>>>> for embedded broker?
>>>>> 
>>>>> 
>>>>> 
>>>>>  <amq:broker useJmx="false" persistent="false">
>>>>>     <amq:transportConnectors>
>>>>>       <amq:transportConnector uri="tcp://localhost:0" />
>>>>>     </amq:transportConnectors>
>>>>>   </amq:broker>
>>>>> 
>>>>>    <!--  ActiveMQ destinations to use  -->
>>>>>   <amq:queue id="destination"
>>>>> physicalName="org.apache.activemq.spring.Test.spring.embedded"/>
>>>>> 
>>>>>   <!-- JMS ConnectionFactory to use, configuring the embedded broker
>>>>> using XML -->
>>>>>   <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>
>>>> 
>>>> Have a look at the Version 5 Transports page for info on the various
>>>> transports.
>>>> http://activemq.apache.org/configuring-version-5-transports.html
>>>> 
>>>> For the TCP transport setting the port to zero means that you want the
>>>> broker to pick an open TCP port.  Normally you wouldn't do this in the
>>>> configuration since will change every time you start the broker, this is
>>>> more useful for unit tests where you want to ensure you get an open
>>>> port.
>>>> 
>>>> 
>>> 
>>> I couldn't get answer to my point 1 and 2
>>> 
>>> 1. what's the different between uri="tcp://localhost:0" and
>>> brokerURL="vm://localhost" ?
>>> 
>>>  <amq:broker id="BridgeBroker" useJmx="true" persistent="false">
>>>    <amq:transportConnectors>
>>>      <amq:transportConnector uri="tcp://localhost:0" />
>>>    </amq:transportConnectors>
>>>  </amq:broker>
>>> 
>>>  <!-- JMS ConnectionFactory to use, configuring the embedded broker
>>> using XML -->
>>>  <amq:connectionFactory id="BridgeJmsFactory" brokerURL="vm://bridgehost"/>
>>> 
>>> 2. In point 1 why are both not tcp?
>>> 
>>> 3. And in point 1 how is broker getting associated with the
>>> connectionfactory since url is different?
>>> 
>>> 
>>>> Regards
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Tim Bish
>>>> ------------
>>>> FuseSource
>>>> Email: tim.bish@fusesource.com
>>>> Web: http://fusesource.com
>>>> Twitter: tabish121
>>>> Blog: http://timbish.blogspot.com/
>>>> 
>>>> 
>>>> 
>>>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 







Re: Understanding basic config

Posted by Mohit Anchlia <mo...@gmail.com>.
On Sat, Oct 1, 2011 at 12:06 AM, Marcelo Jabali <mj...@fusesource.com> wrote:
> Mohit,
>
> ActiveMQ has several transport protocols available (connection URLs for a client to connect to a broker).
> TCP - is used when clients connect to the broker using a TCP socket. VM - is used when you are embedding the broker in your app (client and broker running on the same JVM) and you want to take the performance benefits of connecting the clients to the broker without hitting the network layer. Everything goes through in-memory buffers.
>
> Hope this helps,

That I understand but still not clear about why broker and the factor
are different? Why would broker listen on tcp if client is using vm
call?

<amq:broker id="BridgeBroker" useJmx="true" persistent="false">

   <amq:transportConnectors>
     <amq:transportConnector uri="tcp://localhost:0" />
   </amq:transportConnectors>
 </amq:broker>


 <!-- JMS ConnectionFactory to use, configuring the embedded broker
using XML -->

 <amq:connectionFactory id="BridgeJmsFactory" brokerURL="vm://bridgehost"/>

>
> -Marcelo
>
>
> On Sep 28, 2011, at 4:18 PM, Mohit Anchlia wrote:
>
>> On Wed, Sep 28, 2011 at 3:33 PM, Timothy Bish <ta...@gmail.com> wrote:
>>> On Wed, 2011-09-28 at 14:05 -0700, Mohit Anchlia wrote:
>>>> I have this config. Trying to understand few things:
>>>>
>>>> 1. what's the different between uri="tcp://localhost:0" and
>>>> brokerURL="vm://localhost" ?
>>>> 2. In point 1 why are both not tcp?
>>>> 3. what is :0? That doesn't look like a port to me. Is this specifial
>>>> for embedded broker?
>>>>
>>>>
>>>>
>>>>  <amq:broker useJmx="false" persistent="false">
>>>>     <amq:transportConnectors>
>>>>       <amq:transportConnector uri="tcp://localhost:0" />
>>>>     </amq:transportConnectors>
>>>>   </amq:broker>
>>>>
>>>>    <!--  ActiveMQ destinations to use  -->
>>>>   <amq:queue id="destination"
>>>> physicalName="org.apache.activemq.spring.Test.spring.embedded"/>
>>>>
>>>>   <!-- JMS ConnectionFactory to use, configuring the embedded broker
>>>> using XML -->
>>>>   <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>
>>>
>>> Have a look at the Version 5 Transports page for info on the various
>>> transports.
>>> http://activemq.apache.org/configuring-version-5-transports.html
>>>
>>> For the TCP transport setting the port to zero means that you want the
>>> broker to pick an open TCP port.  Normally you wouldn't do this in the
>>> configuration since will change every time you start the broker, this is
>>> more useful for unit tests where you want to ensure you get an open
>>> port.
>>>
>>>
>>
>> I couldn't get answer to my point 1 and 2
>>
>> 1. what's the different between uri="tcp://localhost:0" and
>> brokerURL="vm://localhost" ?
>>
>>  <amq:broker id="BridgeBroker" useJmx="true" persistent="false">
>>    <amq:transportConnectors>
>>      <amq:transportConnector uri="tcp://localhost:0" />
>>    </amq:transportConnectors>
>>  </amq:broker>
>>
>>  <!-- JMS ConnectionFactory to use, configuring the embedded broker
>> using XML -->
>>  <amq:connectionFactory id="BridgeJmsFactory" brokerURL="vm://bridgehost"/>
>>
>> 2. In point 1 why are both not tcp?
>>
>> 3. And in point 1 how is broker getting associated with the
>> connectionfactory since url is different?
>>
>>
>>> Regards
>>>
>>>
>>>
>>> --
>>> Tim Bish
>>> ------------
>>> FuseSource
>>> Email: tim.bish@fusesource.com
>>> Web: http://fusesource.com
>>> Twitter: tabish121
>>> Blog: http://timbish.blogspot.com/
>>>
>>>
>>>
>>>
>
>
>
>
>
>
>

Re: Understanding basic config

Posted by Marcelo Jabali <mj...@fusesource.com>.
Mohit,

ActiveMQ has several transport protocols available (connection URLs for a client to connect to a broker).
TCP - is used when clients connect to the broker using a TCP socket. VM - is used when you are embedding the broker in your app (client and broker running on the same JVM) and you want to take the performance benefits of connecting the clients to the broker without hitting the network layer. Everything goes through in-memory buffers.

Hope this helps,

-Marcelo


On Sep 28, 2011, at 4:18 PM, Mohit Anchlia wrote:

> On Wed, Sep 28, 2011 at 3:33 PM, Timothy Bish <ta...@gmail.com> wrote:
>> On Wed, 2011-09-28 at 14:05 -0700, Mohit Anchlia wrote:
>>> I have this config. Trying to understand few things:
>>> 
>>> 1. what's the different between uri="tcp://localhost:0" and
>>> brokerURL="vm://localhost" ?
>>> 2. In point 1 why are both not tcp?
>>> 3. what is :0? That doesn't look like a port to me. Is this specifial
>>> for embedded broker?
>>> 
>>> 
>>> 
>>>  <amq:broker useJmx="false" persistent="false">
>>>     <amq:transportConnectors>
>>>       <amq:transportConnector uri="tcp://localhost:0" />
>>>     </amq:transportConnectors>
>>>   </amq:broker>
>>> 
>>>    <!--  ActiveMQ destinations to use  -->
>>>   <amq:queue id="destination"
>>> physicalName="org.apache.activemq.spring.Test.spring.embedded"/>
>>> 
>>>   <!-- JMS ConnectionFactory to use, configuring the embedded broker
>>> using XML -->
>>>   <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>
>> 
>> Have a look at the Version 5 Transports page for info on the various
>> transports.
>> http://activemq.apache.org/configuring-version-5-transports.html
>> 
>> For the TCP transport setting the port to zero means that you want the
>> broker to pick an open TCP port.  Normally you wouldn't do this in the
>> configuration since will change every time you start the broker, this is
>> more useful for unit tests where you want to ensure you get an open
>> port.
>> 
>> 
> 
> I couldn't get answer to my point 1 and 2
> 
> 1. what's the different between uri="tcp://localhost:0" and
> brokerURL="vm://localhost" ?
> 
>  <amq:broker id="BridgeBroker" useJmx="true" persistent="false">
>    <amq:transportConnectors>
>      <amq:transportConnector uri="tcp://localhost:0" />
>    </amq:transportConnectors>
>  </amq:broker>
> 
>  <!-- JMS ConnectionFactory to use, configuring the embedded broker
> using XML -->
>  <amq:connectionFactory id="BridgeJmsFactory" brokerURL="vm://bridgehost"/>
> 
> 2. In point 1 why are both not tcp?
> 
> 3. And in point 1 how is broker getting associated with the
> connectionfactory since url is different?
> 
> 
>> Regards
>> 
>> 
>> 
>> --
>> Tim Bish
>> ------------
>> FuseSource
>> Email: tim.bish@fusesource.com
>> Web: http://fusesource.com
>> Twitter: tabish121
>> Blog: http://timbish.blogspot.com/
>> 
>> 
>> 
>> 







Re: Understanding basic config

Posted by Mohit Anchlia <mo...@gmail.com>.
On Wed, Sep 28, 2011 at 3:33 PM, Timothy Bish <ta...@gmail.com> wrote:
> On Wed, 2011-09-28 at 14:05 -0700, Mohit Anchlia wrote:
>> I have this config. Trying to understand few things:
>>
>> 1. what's the different between uri="tcp://localhost:0" and
>> brokerURL="vm://localhost" ?
>> 2. In point 1 why are both not tcp?
>> 3. what is :0? That doesn't look like a port to me. Is this specifial
>> for embedded broker?
>>
>>
>>
>>  <amq:broker useJmx="false" persistent="false">
>>     <amq:transportConnectors>
>>       <amq:transportConnector uri="tcp://localhost:0" />
>>     </amq:transportConnectors>
>>   </amq:broker>
>>
>>    <!--  ActiveMQ destinations to use  -->
>>   <amq:queue id="destination"
>> physicalName="org.apache.activemq.spring.Test.spring.embedded"/>
>>
>>   <!-- JMS ConnectionFactory to use, configuring the embedded broker
>> using XML -->
>>   <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>
>
> Have a look at the Version 5 Transports page for info on the various
> transports.
> http://activemq.apache.org/configuring-version-5-transports.html
>
> For the TCP transport setting the port to zero means that you want the
> broker to pick an open TCP port.  Normally you wouldn't do this in the
> configuration since will change every time you start the broker, this is
> more useful for unit tests where you want to ensure you get an open
> port.
>
>

I couldn't get answer to my point 1 and 2

1. what's the different between uri="tcp://localhost:0" and
brokerURL="vm://localhost" ?

  <amq:broker id="BridgeBroker" useJmx="true" persistent="false">
    <amq:transportConnectors>
      <amq:transportConnector uri="tcp://localhost:0" />
    </amq:transportConnectors>
  </amq:broker>

  <!-- JMS ConnectionFactory to use, configuring the embedded broker
using XML -->
  <amq:connectionFactory id="BridgeJmsFactory" brokerURL="vm://bridgehost"/>

2. In point 1 why are both not tcp?

3. And in point 1 how is broker getting associated with the
connectionfactory since url is different?


> Regards
>
>
>
> --
> Tim Bish
> ------------
> FuseSource
> Email: tim.bish@fusesource.com
> Web: http://fusesource.com
> Twitter: tabish121
> Blog: http://timbish.blogspot.com/
>
>
>
>

Re: Understanding basic config

Posted by Timothy Bish <ta...@gmail.com>.
On Wed, 2011-09-28 at 14:05 -0700, Mohit Anchlia wrote:
> I have this config. Trying to understand few things:
> 
> 1. what's the different between uri="tcp://localhost:0" and
> brokerURL="vm://localhost" ?
> 2. In point 1 why are both not tcp?
> 3. what is :0? That doesn't look like a port to me. Is this specifial
> for embedded broker?
> 
> 
> 
>  <amq:broker useJmx="false" persistent="false">
>     <amq:transportConnectors>
>       <amq:transportConnector uri="tcp://localhost:0" />
>     </amq:transportConnectors>
>   </amq:broker>
> 
>    <!--  ActiveMQ destinations to use  -->
>   <amq:queue id="destination"
> physicalName="org.apache.activemq.spring.Test.spring.embedded"/>
> 
>   <!-- JMS ConnectionFactory to use, configuring the embedded broker
> using XML -->
>   <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>

Have a look at the Version 5 Transports page for info on the various
transports.
http://activemq.apache.org/configuring-version-5-transports.html

For the TCP transport setting the port to zero means that you want the
broker to pick an open TCP port.  Normally you wouldn't do this in the
configuration since will change every time you start the broker, this is
more useful for unit tests where you want to ensure you get an open
port.


Regards



-- 
Tim Bish
------------
FuseSource
Email: tim.bish@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/