activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r520532 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/processor/ camel-cor...
Date Tue, 20 Mar 2007 19:31:49 GMT
Author: chirino
Date: Tue Mar 20 12:31:47 2007
New Revision: 520532

URL: http://svn.apache.org/viewvc?view=rev&rev=520532
Log:
Made CamelContext an interface and move the implementation to impl.DefaultCamelContext


Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/pojo/PojoRouteTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/queue/QueueRouteTest.java
    activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java?view=diff&rev=520532&r1=520531&r2=520532
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java Tue Mar
20 12:31:47 2007
@@ -17,178 +17,81 @@
  */
 package org.apache.camel;
 
-import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.Callable;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.DefaultEndpointResolver;
-import org.apache.camel.impl.DefaultExchangeConverter;
-import org.apache.camel.impl.DefaultTypeConverter;
 
 /**
- * Represents the context used to configure routes and the policies to use.
+ * Interface used to represent the context used to configure routes and the 
+ * policies to use during message exchanges between endpoints.
  *
  * @version $Revision$
- * @org.apache.xbean.XBean element="container" rootElement="true"
  */
-public class CamelContext<E extends Exchange> {
-
-    private EndpointResolver<E> endpointResolver;
-    private ExchangeConverter exchangeConverter;
-    private Map<String, Component> components = new HashMap<String, Component>();
-	private Map<Endpoint<E>, Processor<E>> routes;
-    private TypeConverter typeConverter;
+public interface CamelContext<E extends Exchange> {
     
+	// Component Management Methods
+    //-----------------------------------------------------------------------
+
     /**
-     * Activates all the starting endpoints in that were added as routes.
+     * Adds a component to the container.
      */
-    public void activateEndpoints() {
-        for (Map.Entry<Endpoint<E>, Processor<E>> entry : routes.entrySet())
{
-            Endpoint<E> endpoint = entry.getKey();
-            Processor<E> processor = entry.getValue();
-            endpoint.activate(processor);
-        }
-    }
+    public void addComponent(String componentName, final Component<E> component);
+
+    public Component getComponent(String componentName);
     
     /**
-     * Deactivates all the starting endpoints in that were added as routes.
+     * Removes a previously added component.
+     * @param componentName
+     * @return the previously added component or null if it had not been previously added.
      */
-    public void deactivateEndpoints() {
-        for (Endpoint<E> endpoint : routes.keySet()) {
-            endpoint.deactivate();
-        }
-    }
-
-
-    public Component getOrCreateComponent(String componentName, Callable<Component<E>>
factory) {
-        synchronized (components) {
-            Component component = components.get(componentName);
-            if (component == null) {
-                try {
-                    component = factory.call();
-                    if (component == null) {
-                        throw new IllegalArgumentException("Factory failed to create the
" + componentName + " component, it returned null.");
-                    }
-                    components.put(componentName, component);
-                    component.setContainer(this);
-                }
-                catch (Exception e) {
-                    throw new IllegalArgumentException("Factory failed to create the " +
componentName + " component", e);
-                }
-            }
-            return component;
-        }
-    }
-
-    public Component getComponent(String componentName) {
-        synchronized (components) {
-            Component component = components.get(componentName);
-            return component;
-        }
-    }
-
-
-    // Builder APIs
-    //-----------------------------------------------------------------------
-    public void routes(RouteBuilder<E> builder) {
-        // lets now add the routes from the builder
-        builder.setContainer(this);
-        routes = builder.getRouteMap();
-    }
-
-    public void routes(final RouteFactory factory) {
-        RouteBuilder<E> builder = new RouteBuilder<E>(this) {
-            public void configure() {
-                factory.build(this);
-            }
-        };
-        routes(builder);
-    }
-
+    public Component removeComponent(String componentName);
 
     /**
-     * Adds a component to the container if there is not currently a component already registered.
+     * Gets the a previously added component by name or lazily creates the component
+     * using the factory Callback. 
+     * 
+     * @param componentName
+     * @param factory used to create a new component instance if the component was not previously
added.
+     * @return
      */
-    public void addComponent(String componentName, final Component<E> component) {
-        // TODO provide a version of this which barfs if the component is registered multiple
times
-
-        getOrCreateComponent(componentName, new Callable<Component<E>>() {
-            public Component<E> call() throws Exception {
-                return component;
-            }
-        });
-    }
-
+    public Component getOrCreateComponent(String componentName, Callable<Component<E>>
factory);
+    
+    // Endpoint Management Methods
+    //-----------------------------------------------------------------------
 
-    /**O
+    /**
      * Resolves the given URI to an endpoint
      */
-    public Endpoint<E> endpoint(String uri) {
-         EndpointResolver<E> er = getEndpointResolver();
-         return er.resolveEndpoint(this, uri);
-    }
-
-
-    // Properties
-    //-----------------------------------------------------------------------
-    public EndpointResolver<E> getEndpointResolver() {
-        if (endpointResolver == null) {
-            endpointResolver = createEndpointResolver();
-        }
-        return endpointResolver;
-    }
-
-    public void setEndpointResolver(EndpointResolver<E> endpointResolver) {
-        this.endpointResolver = endpointResolver;
-    }
-
-    public ExchangeConverter getExchangeConverter() {
-        if (exchangeConverter == null) {
-            exchangeConverter = createExchangeConverter();
-        }
-        return exchangeConverter;
-    }
-
-    public void setExchangeConverter(ExchangeConverter exchangeConverter) {
-        this.exchangeConverter = exchangeConverter;
-    }
-
-    public TypeConverter getTypeConverter() {
-        if (typeConverter == null) {
-            typeConverter = createTypeConverter();
-        }
-        return typeConverter;
-    }
-
-    public void setTypeConverter(TypeConverter typeConverter) {
-        this.typeConverter = typeConverter;
-    }
-
-    // Implementation methods
-    //-----------------------------------------------------------------------
-
+    public Endpoint<E> resolveEndpoint(String uri);
+    
     /**
-     * Lazily create a default implementation
+     * Activates all the starting endpoints in that were added as routes.
      */
-    protected EndpointResolver<E> createEndpointResolver() {
-        return new DefaultEndpointResolver<E>();
-    }
-
-
+    public void activateEndpoints();
+    
     /**
-     * Lazily create a default implementation
+     * Deactivates all the starting endpoints in that were added as routes.
      */
-    protected ExchangeConverter createExchangeConverter() {
-        return new DefaultExchangeConverter();
-    }
+    public void deactivateEndpoints() ;
 
+    // Route Management Methods
+    //-----------------------------------------------------------------------
+	public Map<Endpoint<E>, Processor<E>> getRoutes() ;
+	
+	public void setRoutes(Map<Endpoint<E>, Processor<E>> routes);
+	
+    public void setRoutes(RouteBuilder<E> builder);
+
+    public void setRoutes(final RouteFactory factory);
+
+    // Properties
+    //-----------------------------------------------------------------------
+    public EndpointResolver<E> getEndpointResolver();
+    
+    public ExchangeConverter getExchangeConverter();
+
+    public TypeConverter getTypeConverter();
 
-    /**
-     * Lazily create a default implementation
-     */
-    private TypeConverter createTypeConverter() {
-        return new DefaultTypeConverter();
-    }
 
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java?view=diff&rev=520532&r1=520531&r2=520532
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
Tue Mar 20 12:31:47 2007
@@ -21,6 +21,7 @@
 import org.apache.camel.EndpointResolver;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.impl.DefaultCamelContext;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -123,6 +124,6 @@
     }
 
     protected CamelContext<E> createContainer() {
-        return new CamelContext<E>();
+        return new DefaultCamelContext<E>();
     }
 }

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?view=auto&rev=520532
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
(added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
Tue Mar 20 12:31:47 2007
@@ -0,0 +1,223 @@
+/**
+ *
+ * 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.
+ */
+package org.apache.camel.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointResolver;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangeConverter;
+import org.apache.camel.Processor;
+import org.apache.camel.RouteFactory;
+import org.apache.camel.TypeConverter;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * Represents the context used to configure routes and the policies to use.
+ *
+ * @version $Revision: 520517 $
+ * @org.apache.xbean.XBean element="container" rootElement="true"
+ */
+public class DefaultCamelContext<E extends Exchange> implements CamelContext<E>
{
+
+    private EndpointResolver<E> endpointResolver;
+    private ExchangeConverter exchangeConverter;
+    private Map<String, Component> components = new HashMap<String, Component>();
+	private Map<Endpoint<E>, Processor<E>> routes;
+    private TypeConverter typeConverter;
+    
+    /**
+     * Adds a component to the container.
+     */
+    public void addComponent(String componentName, final Component<E> component) {
+        synchronized (components) {
+            if( components.containsKey(componentName) ) {
+            	throw new IllegalArgumentException("Component previously added: "+componentName);
+            }
+            components.put(componentName, component);
+        }
+    }
+
+    public Component getComponent(String componentName) {
+        synchronized (components) {
+            return components.get(componentName);
+        }
+    }
+    
+    /**
+     * Removes a previously added component.
+     * @param componentName
+     * @return the previously added component or null if it had not been previously added.
+     */
+    public Component removeComponent(String componentName) {
+        synchronized (components) {
+            return components.remove(componentName);
+        }
+    }
+
+    /**
+     * Gets the a previously added component by name or lazily creates the component
+     * using the factory Callback. 
+     * 
+     * @param componentName
+     * @param factory used to create a new component instance if the component was not previously
added.
+     * @return
+     */
+    public Component getOrCreateComponent(String componentName, Callable<Component<E>>
factory) {
+        synchronized (components) {
+            Component component = components.get(componentName);
+            if (component == null) {
+                try {
+                    component = factory.call();
+                    if (component == null) {
+                        throw new IllegalArgumentException("Factory failed to create the
" + componentName + " component, it returned null.");
+                    }
+                    components.put(componentName, component);
+                    component.setContainer(this);
+                }
+                catch (Exception e) {
+                    throw new IllegalArgumentException("Factory failed to create the " +
componentName + " component", e);
+                }
+            }
+            return component;
+        }
+    }
+
+    // Endpoint Management Methods
+    //-----------------------------------------------------------------------
+
+    /**
+     * Resolves the given URI to an endpoint
+     */
+    public Endpoint<E> resolveEndpoint(String uri) {
+         EndpointResolver<E> er = getEndpointResolver();
+         return er.resolveEndpoint(this, uri);
+    }
+    
+    /**
+     * Activates all the starting endpoints in that were added as routes.
+     */
+    public void activateEndpoints() {
+        for (Map.Entry<Endpoint<E>, Processor<E>> entry : routes.entrySet())
{
+            Endpoint<E> endpoint = entry.getKey();
+            Processor<E> processor = entry.getValue();
+            endpoint.activate(processor);
+        }
+    }
+    
+    /**
+     * Deactivates all the starting endpoints in that were added as routes.
+     */
+    public void deactivateEndpoints() {
+        for (Endpoint<E> endpoint : routes.keySet()) {
+            endpoint.deactivate();
+        }
+    }
+
+    // Route Management Methods
+    //-----------------------------------------------------------------------
+	public Map<Endpoint<E>, Processor<E>> getRoutes() {
+		return routes;
+	}
+
+	public void setRoutes(Map<Endpoint<E>, Processor<E>> routes) {
+		this.routes = routes;
+	}
+
+    public void setRoutes(RouteBuilder<E> builder) {
+        // lets now add the routes from the builder
+        builder.setContainer(this);
+        setRoutes(builder.getRouteMap());
+    }
+
+    public void setRoutes(final RouteFactory factory) {
+        RouteBuilder<E> builder = new RouteBuilder<E>(this) {
+            public void configure() {
+                factory.build(this);
+            }
+        };
+        setRoutes(builder);
+    }
+
+    // Properties
+    //-----------------------------------------------------------------------
+    public EndpointResolver<E> getEndpointResolver() {
+        if (endpointResolver == null) {
+            endpointResolver = createEndpointResolver();
+        }
+        return endpointResolver;
+    }
+
+    public void setEndpointResolver(EndpointResolver<E> endpointResolver) {
+        this.endpointResolver = endpointResolver;
+    }
+
+    public ExchangeConverter getExchangeConverter() {
+        if (exchangeConverter == null) {
+            exchangeConverter = createExchangeConverter();
+        }
+        return exchangeConverter;
+    }
+
+    public void setExchangeConverter(ExchangeConverter exchangeConverter) {
+        this.exchangeConverter = exchangeConverter;
+    }
+
+    public TypeConverter getTypeConverter() {
+        if (typeConverter == null) {
+            typeConverter = createTypeConverter();
+        }
+        return typeConverter;
+    }
+
+    public void setTypeConverter(TypeConverter typeConverter) {
+        this.typeConverter = typeConverter;
+    }
+
+    // Implementation methods
+    //-----------------------------------------------------------------------
+
+    /**
+     * Lazily create a default implementation
+     */
+    protected EndpointResolver<E> createEndpointResolver() {
+        return new DefaultEndpointResolver<E>();
+    }
+
+
+    /**
+     * Lazily create a default implementation
+     */
+    protected ExchangeConverter createExchangeConverter() {
+        return new DefaultExchangeConverter();
+    }
+
+
+    /**
+     * Lazily create a default implementation
+     */
+    private TypeConverter createTypeConverter() {
+        return new DefaultTypeConverter();
+    }
+
+}

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java?view=diff&rev=520532&r1=520531&r2=520532
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
Tue Mar 20 12:31:47 2007
@@ -64,7 +64,7 @@
         }
         else {
             String uri = recipient.toString();
-            endpoint = (Endpoint<E>) exchange.getContext().endpoint(uri);
+            endpoint = (Endpoint<E>) exchange.getContext().resolveEndpoint(uri);
             if (endpoint == null) {
                 throw new NoSuchEndpointException(uri);
             }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/pojo/PojoRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/pojo/PojoRouteTest.java?view=diff&rev=520532&r1=520531&r2=520532
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/pojo/PojoRouteTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/pojo/PojoRouteTest.java
Tue Mar 20 12:31:47 2007
@@ -22,6 +22,8 @@
 import junit.framework.TestCase;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.processor.InterceptorProcessor;
 import org.apache.camel.builder.RouteBuilder;
 
@@ -32,7 +34,8 @@
 	
     public void testJmsRoute() throws Exception {
 
-        CamelContext container = new CamelContext();
+        CamelContext container = new DefaultCamelContext<Exchange>();
+        
         PojoComponent component = new PojoComponent();
         component.registerPojo("hello", new SayService("Hello!"));
         component.registerPojo("bye", new SayService("Good Bye!"));
@@ -47,7 +50,7 @@
         	}
         };
         // lets add some routes
-        container.routes(new RouteBuilder() {
+        container.setRoutes(new RouteBuilder() {
             public void configure() {
                 from("pojo:default:hello").intercept(tracingInterceptor).target().to("pojo:default:bye");
                 
@@ -59,13 +62,13 @@
         container.activateEndpoints();
         
         // now lets fire in a message
-        PojoEndpoint endpoint = (PojoEndpoint) container.endpoint("pojo:default:hello");
+        PojoEndpoint endpoint = (PojoEndpoint) container.resolveEndpoint("pojo:default:hello");
         ISay proxy = (ISay) endpoint.createInboundProxy(new Class[]{ISay.class});
         String rc = proxy.say();
         assertEquals("Good Bye!", rc);
 
         try {
-			endpoint = (PojoEndpoint) container.endpoint("pojo:default:bye");
+			endpoint = (PojoEndpoint) container.resolveEndpoint("pojo:default:bye");
 			proxy = (ISay) endpoint.createInboundProxy(new Class[]{ISay.class});
 			rc = proxy.say();
 			assertEquals("Hello!", rc);

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/queue/QueueRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/queue/QueueRouteTest.java?view=diff&rev=520532&r1=520531&r2=520532
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/queue/QueueRouteTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/queue/QueueRouteTest.java
Tue Mar 20 12:31:47 2007
@@ -27,6 +27,7 @@
 import org.apache.camel.Processor;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
 
 /**
  * @version $Revision: 520220 $
@@ -37,10 +38,10 @@
     public void testJmsRoute() throws Exception {
         final CountDownLatch latch = new CountDownLatch(1);
 
-        CamelContext container = new CamelContext();
+        CamelContext container = new DefaultCamelContext<Exchange>();
 
         // lets add some routes
-        container.routes(new RouteBuilder() {
+        container.setRoutes(new RouteBuilder() {
             public void configure() {
                 from("queue:test.a").to("queue:test.b");
                 from("queue:test.b").process(new Processor<Exchange>() {
@@ -56,7 +57,7 @@
         container.activateEndpoints();
         
         // now lets fire in a message
-        Endpoint<Exchange> endpoint = container.endpoint("queue:test.a");
+        Endpoint<Exchange> endpoint = container.resolveEndpoint("queue:test.a");
         Exchange exchange = endpoint.createExchange();
         exchange.getIn().getHeaders().setHeader("cheese", 123);
         endpoint.onExchange(exchange);

Modified: activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java?view=diff&rev=520532&r1=520531&r2=520532
==============================================================================
--- activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java (original)
+++ activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java Tue
Mar 20 12:31:47 2007
@@ -17,17 +17,22 @@
  */
 package org.apache.camel.jms;
 
+import static org.apache.camel.jms.JmsComponent.jmsComponentClientAcknowledge;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.jms.ConnectionFactory;
+
 import junit.framework.TestCase;
+
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import static org.apache.camel.jms.JmsComponent.jmsComponentClientAcknowledge;
-
-import javax.jms.ConnectionFactory;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
+import org.apache.camel.impl.DefaultCamelContext;
 
 /**
  * @version $Revision$
@@ -36,14 +41,14 @@
     public void testJmsRoute() throws Exception {
         final CountDownLatch latch = new CountDownLatch(1);
 
-        CamelContext container = new CamelContext();
+        CamelContext container = new DefaultCamelContext<Exchange>();
 
         // lets configure some componnets
         ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
         container.addComponent("activemq", jmsComponentClientAcknowledge(connectionFactory));
 
         // lets add some routes
-        container.routes(new RouteBuilder() {
+        container.setRoutes(new RouteBuilder() {
             public void configure() {
                 from("jms:activemq:test.a").to("jms:activemq:test.b");
                 from("jms:activemq:test.b").process(new Processor<JmsExchange>() {
@@ -59,7 +64,7 @@
         container.activateEndpoints();
         
         // now lets fire in a message
-        Endpoint<JmsExchange> endpoint = container.endpoint("jms:activemq:test.a");
+        Endpoint<JmsExchange> endpoint = container.resolveEndpoint("jms:activemq:test.a");
         JmsExchange exchange2 = endpoint.createExchange();
         //exchange2.setInBody("Hello there!")
         exchange2.getIn().getHeaders().setHeader("cheese", 123);



Mime
View raw message