Hi What version of Camel do you use?
Sounds a bit weird. Can you check your classpath that you use the same version of Camel JARs. The api of camelcontext is in the javadocs here http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html On Wed, Feb 12, 2014 at 12:34 PM, Pearl <[email protected]> wrote: > Hi, > > Please have a look into my code given below: > > import javax.jms.ConnectionFactory; > > import org.apache.activemq.ActiveMQConnectionFactory; > import org.apache.camel.CamelContext; > import org.apache.camel.ProducerTemplate; > import org.apache.camel.builder.RouteBuilder; > import org.apache.camel.component.jms.JmsComponent; > import org.apache.camel.impl.DefaultCamelContext; > > > public final class CamelJmsToFileExample { > > private CamelJmsToFileExample() { > } > > public static void main(String args[]) throws Exception { > > CamelContext context = new DefaultCamelContext(); > > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); > > context.addComponent("test-jms", > JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); > > context.addRoutes(new RouteBuilder() { > public void configure() { > from("test-jms:queue:test.queue").to("file://test"); > } > }); > > ProducerTemplate template = context.createProducerTemplate(); > > context.start(); > > for (int i = 0; i < 10; i++) { > template.sendBody("test-jms:queue:test.queue", "Test Message: " > + i); > } > > Thread.sleep(1000); > context.stop(); > } > } > > > I'm getting an error here as: > > The method createProducerTemplate() is undefined for the type CamelContext. > > > Please help... > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/The-method-createProducerTemplate-is-undefined-for-the-type-CamelContext-tp5747181.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen Make your Camel applications look hawt, try: http://hawt.io
