Java tutorial
package org.ivanursul.investigation; /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import org.apache.camel.ExchangePattern; import org.apache.camel.ProducerTemplate; import org.apache.camel.util.IOHelper; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public final class CamelClient { public static void main(final String[] args) throws Exception { AbstractApplicationContext context = new ClassPathXmlApplicationContext("camel-client.xml"); ProducerTemplate camelTemplate = context.getBean("camelTemplate", ProducerTemplate.class); Integer value = 33; // Sending request and receiving result. int response = (Integer) camelTemplate.sendBody("jms:queue:numbers?requestTimeout=2000000", ExchangePattern.InOut, value); // Sending to votes without receiving any result. camelTemplate.sendBody("jms:queue:votes", response); IOHelper.close(context); } }