Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » ActiveMQ Integration(How to drop in ActiveMQ broker)
ActiveMQ Integration [message #930481] Tue, 02 October 2012 11:07 Go to next message
Alex Bond is currently offline Alex Bond
Messages: 1
Registered: October 2012
Junior Member
Hey guys!

I'm trying to integrate ActiveMQ into my Virgo server. Is there a common way to just drop in the jar (or something like that) without writing any line of code? Just out of the box.

Furthermore, it should be configurable. I've seen the karaf example at the activeMQ page (where it creates a XML file and you just modify it). Is there something similar for the virgo server?

Thanks a lot,
Alex
Re: ActiveMQ Integration [message #933916 is a reply to message #930481] Fri, 05 October 2012 13:06 Go to previous messageGo to next message
Charlie Mordant is currently offline Charlie Mordant
Messages: 81
Registered: July 2010
Member

Hi,

I integrated activemq in Virgo, you just have to make a little bundle containing the amq configuration, here's mine (it just embed a META-INF/spring/activemqconf.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:amq="http://activemq.apache.org/schema/core" 
	xmlns:osgi="http://www.springframework.org/schema/osgi"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
	http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
	http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<osgi-compendium:cm-properties id="jmsConfigProperties" persistent-id="jms-config"/>
<context:property-placeholder properties-ref="jmsConfigProperties"/>
	<amq:broker brokerName="brokerB1" shutdownOnMasterFailure="true"
		>
		<amq:destinationPolicy>
			<amq:policyMap>
				<amq:policyEntries>
					<amq:policyEntry queue=">" producerFlowControl="true"
						memoryLimit="5mb">
						<amq:deadLetterStrategy>
							<amq:individualDeadLetterStrategy
								queuePrefix="DLQ." useQueueForQueueMessages="true" />
						</amq:deadLetterStrategy>
					</amq:policyEntry>
				</amq:policyEntries>
			</amq:policyMap>
		</amq:destinationPolicy>
		<amq:managementContext>
			<amq:managementContext createConnector="false" />
		</amq:managementContext>
		<amq:persistenceAdapter>
			<amq:kahaDB directory="activeMQ/kahadb"
				enableJournalDiskSyncs="false" indexWriteBatchSize="10000"
				indexCacheSize="1000" />
		</amq:persistenceAdapter>
		<amq:plugins>
			<amq:loggingBrokerPlugin />
		</amq:plugins>
		<amq:systemUsage>
			<amq:systemUsage>
				<amq:memoryUsage>
					<amq:memoryUsage limit="420 mb" />
				</amq:memoryUsage>
				<amq:storeUsage>
					<amq:storeUsage limit="1 gb" />
				</amq:storeUsage>
				<amq:tempUsage>
					<amq:tempUsage limit="250 mb" />
				</amq:tempUsage>
			</amq:systemUsage>
		</amq:systemUsage>
		<amq:transportConnectors>
			<amq:transportConnector name="tcp"
				uri="${transportconnector.uri}" />
		</amq:transportConnectors>
	</amq:broker>
	<!-- JMS ConnectionFactory to use, configuring the embedded broker using 
		XML -->
	<amq:connectionFactory id="jmsFactory" brokerURL="${connectionfactory.uri}" />

	<bean id="cachedConnectionFactory"
               class="org.springframework.jms.connection.CachingConnectionFactory">
               <property name="targetConnectionFactory" ref="jmsFactory" />
               <property name="sessionCacheSize" value="3" />
        </bean>
	<osgi:service ref="cachedConnectionFactory"
		interface="javax.jms.ConnectionFactory"/>
</beans> 

With this, you can have a jms-config.properties in your usr repo:
transportconnector.uri=tcp://0.0.0.0:61616
connectionfactory.uri=vm://localhost


Then you should be able to reference the amq connectionfaction via service reference (blueprint, spring-dm...).

Charlie

[Updated on: Fri, 05 October 2012 13:09]

Report message to a moderator

Re: ActiveMQ Integration [message #1000022 is a reply to message #933916] Sun, 13 January 2013 20:05 Go to previous messageGo to next message
Miguel Salinas Gancedo is currently offline Miguel Salinas Gancedo
Messages: 8
Registered: October 2012
Junior Member
Hi Charlie,

I was trying to follow your example with Virgo 3.0.2. I create the bundle like you and add the necesary bundles to my virgo instance and create the properties file called jms-config.properties and save it in:

/opt/virgo-tomcat-server-3.0.3.RELEASE/repository/usr directory

And i obtaind the error:

... Could not resolve placeholder 'transportconnector.uri'

That you see i cant not recover the properties from the file throw spring. I also save the file in the /opt/virgo-tomcat-server-3.0.3.RELEASE/repository/usr/config directory and the error it's the same.

If I add default values to the properties configuration the system run ok, but if not I obtained the previous error:
<osgi-compendium:cm-properties id="jmsConfigProperties" persistent-id="jms-config">
<prop key="transportconnector.uri">tcp://0.0.0.0:61616</prop>
<prop key="connectionfactory.uri">vm://localhost</prop>
</osgi-compendium:cm-properties>


Where I must save the properties file inside Virgo?


Best regards.

[Updated on: Sun, 13 January 2013 20:27]

Report message to a moderator

Re: ActiveMQ Integration [message #1000264 is a reply to message #1000022] Mon, 14 January 2013 11:54 Go to previous message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
You need to deploy jms-config.properties preferably by referencing it from a plan that you deploy somehow (pickup, admin console, etc.) or by copying it to pickup.
Previous Topic:Virgo automatically stops
Next Topic:ClassNotFoundException: javax.validation.spi.ValidationProvider after upgrade to Virgo 3.6
Goto Forum:
  


Current Time: Sat Sep 20 20:12:41 GMT 2014

Powered by FUDForum. Page generated in 0.01855 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software