the vm protocol handler supports an embedded broker: scheme where the
broker configuration uri syntax can be used:

Something like: vm:broker:(tcp://localhost:61616)?persistent=false

see: 
http://activemq.apache.org/vm-transport-reference.html#VMTransportReference-AdvancedBrokerConfigurationSyntax



2009/1/19 Henri Gomez <henri.go...@gmail.com>:
> Under debug I could see in the ConnectionFactory :
>
> brokerUrl = vm://localhost?broker.persistent=false,tcp://localhost:61616
>
> I wonder why the TCP port is not opened ;(
>
>
> 2009/1/19 Henri Gomez <henri.go...@gmail.com>:
>> Hi to all,
>>
>> I read carefully the docs about declaring an ActiveMQ in Tomcat :
>>
>> http://activemq.apache.org/tomcat.html
>>
>> I need to get ActiveMQ embedded in a webapp and for both in VM clients
>> but also external clients and want to get the setup in context.xml :
>>
>> I tried to add in context.xml :
>>
>>  <Resource name="jms/ConnectionFactory" auth="Container"
>> type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS
>> Connection Factory"
>>        factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> brokerURL="vm://localhost" brokerName="LocalActiveMQBroker"/>
>>
>>
>> I couldn't see tcp port opend.
>>
>>  <Resource name="jms/ConnectionFactory" auth="Container"
>> type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS
>> Connection Factory"
>>        factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> brokerURL="tcp://localhost:61616" brokerName="LocalActiveMQBroker"
>>        useEmbeddedBroker="true" />
>>
>> No more luck.
>>
>> How could I get it works ?
>>
>> With both configuration I could see the broker available by adding in
>> a StartupServlet :
>>
>>                try {
>>                    InitialContext initCtx = new InitialContext();
>>                    Context envContext = (Context) 
>> initCtx.lookup("java:comp/env");
>>                    ConnectionFactory connectionFactory = (ConnectionFactory)
>> envContext.lookup("jms/ConnectionFactory");
>>                    Connection connection = 
>> connectionFactory.createConnection();
>>                    Session session = connection.createSession(false,
>> Session.AUTO_ACKNOWLEDGE);
>>                    MessageProducer producer = 
>> session.createProducer((Destination)
>> envContext.lookup("jms/topic/MyTopic"));
>>
>>                    Message testMessage = session.createMessage();
>>                    testMessage.setStringProperty("testKey", "testValue");
>>                    producer.send(testMessage);
>>                } catch (NamingException ne) {
>>                    System.err.println("NamingException: " + ne);
>>                } catch (JMSException jmse) {
>>                    System.err.println("NamingException: " + jmse);
>>                }
>>
>> My question is :
>>
>> How could we get Tomcat 6 start an ActiveMQ in embedded mode with
>> opened connections to outside clients.
>>
>> Regards
>>
>



-- 
http://blog.garytully.com

Open Source SOA
http://FUSESource.com

Reply via email to