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

Reply via email to