So I am guessing that if I build my own JMS connection with the ProducerTemplate, than I lose all of the nice features of the camel jms component (like the reconnect logic, etc.) because the camel-jms is just a wrapper around the spring-jms. I would have to rebuild all of that myself without using Spring.
James may be right -- it might be time to find a new job :-) On Mon, Jul 19, 2010 at 1:13 PM, Claus Ibsen <claus.ib...@gmail.com> wrote: > Hi > > > On Mon, Jul 19, 2010 at 8:06 PM, Ron Smith <ronsmit...@gmail.com> wrote: > > Where I work, Spring has been declared "evil" so I am attempting to use > > camel without any of the Spring JARs but I can't find any examples of how > to > > setup a JMS component without a Spring dependency. I am using Tibco as > the > > JMS provider and it is providing JNDI. > > > > It must be a touch workplace when a general considered standard > framework is considered evil? > > The camel-jms component leverages spring-jms for sending and receiving > JMS messages and therefore > you cannot use it without spring-jms. > > You can use plain JMS API if you want to avoid Spring and build a JMS > consumer. > For examples see the ActiveMQ in Action which shows that. And I am > sure you may find other examples by googling as well. > > To send the message to Camel is very easy from Java code. For example > just use the ProducerTemplate API. > > > > > Here is a sample code snippet which shows the JNDI and JMS setup that I > need > > for the component: > > > > final CamelContext context = new DefaultCamelContext(); > > final Hashtable env = new Hashtable(); > > env.put(Context.INITIAL_CONTEXT_FACTORY, > > "com.tibco.tibjms.naming.TibjmsInitialContextFactory"); > > env.put(Context.PROVIDER_URL, Constants.TOPIC_PROVIDER_URL)); > > env.put(Context.SECURITY_PRINCIPAL, Constants.TOPIC_SECURITY_PRINCIPAL)); > > env.put(Context.SECURITY_CREDENTIALS, > > Constants.TOPIC_SECURITY_CREDENTIALS)); > > final Context jndiContext = new InitialContext(env); > > final TopicConnectionFactory topicConnectionFactory = > > (TopicConnectionFactory) > > jndiContext.lookup(Constants.TOPIC_CONNECTION_FACTORY)); > > > > context.addComponent("tibco", > > JmsComponent.jmsComponentAutoAcknowledge(topicConnectionFactory)); > > > > > > This compiles without any Spring JARs but, when I run it I get the > following > > exception thrown by the last line of code: > > > > > > Caused by: java.lang.ClassNotFoundException: > > org.springframework.context.ApplicationContextAware > > > > > > > > NOTE: I am currently looking into the possibility that this is actually > an > > issue with the DefaultCamelContext being dependent on Spring rather that > it > > being a JMS or component issue. In any case, I would appreciate any > advice > > or guidance on this. > > > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus >