Re: Quartz dependency missing for 1.6.6

2009-11-21 Thread Claus Ibsen
On Sun, Nov 22, 2009 at 8:44 AM, Claus Ibsen  wrote:
> On Sun, Nov 22, 2009 at 4:57 AM, huntc  wrote:
>>
>> Hi guys,
>>
>> I'm attempting to build against the 2.1-SNAPSHOT at the moment and
>> experience:
>>
>> Missing indirectly referenced artifact opensymphony:quartz:jar:1.6.6:compile
>>
>> I see that 1.6.6 is a fairly new release and may not yet have made it to any
>> well known repos. Any advice on this?
>>
>
> Its in this repo
> http://repo.fusesource.com/maven2-all/opensymphony/quartz/1.6.6/
>
> I wonder if that repo was missing in the pom.xml of quartz. Let me check.
>

Its included in the pom.xml. Maybe you need to do a full clean build
to get it working.


>> Kind regards,
>> Christopher
>> --
>> View this message in context: 
>> http://old.nabble.com/Quartz-dependency-missing-for-1.6.6-tp26462662p26462662.html
>> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> 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
>



-- 
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


Re: getEndpoints deprecated for 2.1 - please advise why

2009-11-21 Thread Claus Ibsen
On Sun, Nov 22, 2009 at 7:38 AM, huntc  wrote:
>
> Hi,
>
> I'm using the following method on the camel context:
>
>
> Collection cardReaderEndpoints =
>  exchange.getContext().getEndpoints(bgReaderListenerURI);
>
>
> I note that with 2.1 this is marked as being deprecated. The source code
> states:
>
>
> makes no sense, is removed in Camel 2.2
>

There are plenty of other methods on CamelContext to get endpoints. So
use any of those.
We are trimming down the number of methods on the context to remove
methods which are very rarely used (by Camel itself or end users)



>
> Well, the deprecation makes no sense to me! %-|
>
> I use the above method call to return a list of endpoints connected on a tcp
> socket (MINA). How else might I do this?
>
> Kind regards,
> Christopher
> --
> View this message in context: 
> http://old.nabble.com/getEndpoints-deprecated-for-2.1---please-advise-why-tp26463149p26463149.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>



-- 
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


Re: Quartz dependency missing for 1.6.6

2009-11-21 Thread Claus Ibsen
On Sun, Nov 22, 2009 at 4:57 AM, huntc  wrote:
>
> Hi guys,
>
> I'm attempting to build against the 2.1-SNAPSHOT at the moment and
> experience:
>
> Missing indirectly referenced artifact opensymphony:quartz:jar:1.6.6:compile
>
> I see that 1.6.6 is a fairly new release and may not yet have made it to any
> well known repos. Any advice on this?
>

Its in this repo
http://repo.fusesource.com/maven2-all/opensymphony/quartz/1.6.6/

I wonder if that repo was missing in the pom.xml of quartz. Let me check.

> Kind regards,
> Christopher
> --
> View this message in context: 
> http://old.nabble.com/Quartz-dependency-missing-for-1.6.6-tp26462662p26462662.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
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


getEndpoints deprecated for 2.1 - please advise why

2009-11-21 Thread huntc

Hi,

I'm using the following method on the camel context:


Collection cardReaderEndpoints = 
  exchange.getContext().getEndpoints(bgReaderListenerURI);


I note that with 2.1 this is marked as being deprecated. The source code
states:


makes no sense, is removed in Camel 2.2


Well, the deprecation makes no sense to me! %-|

I use the above method call to return a list of endpoints connected on a tcp
socket (MINA). How else might I do this?

Kind regards,
Christopher
-- 
View this message in context: 
http://old.nabble.com/getEndpoints-deprecated-for-2.1---please-advise-why-tp26463149p26463149.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Jms remoting failover problem

2009-11-21 Thread Ming Fang
Here is the smallest problem that demonstrates the problem.

Java file

package test;

import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.camel.component.*;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.bean.ProxyHelper;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.log4j.*;

public class ActiveMQTest {

public static void main(String[] args) throws Exception {
//log4j
Logger.getRootLogger().addAppender(new ConsoleAppender(new 
PatternLayout(PatternLayout.DEFAULT_CONVERSION_PATTERN)));
System.getProperties().put("org.apache.camel.jmx.disabled", "true");

//needs at least 2 servers to see problem.
simulatorServer("tcp://localhost:61616");
simulatorServer("tcp://localhost:61617");
simulatorServer("tcp://localhost:61618");

//client
CamelContext camelContext = new DefaultCamelContext();
ActiveMQConfiguration configuration = new ActiveMQConfiguration();

configuration.setBrokerURL("failover://(tcp://localhost:61616,tcp://localhost:61617,tcp://localhost:61618)");
camelContext.addComponent("jms", new ActiveMQComponent(configuration));
camelContext.start();

//invoke server. likely to fail when sleepTime is over 30 seconds
Echo service = 
ProxyHelper.createProxy(camelContext.getEndpoint("jms:queue:echo"), Echo.class);
int sleepTime = 31000;
while (true) {
System.out.println(service.echo("test"));
Thread.sleep(sleepTime);
}
}

private static void simulatorServer(final String url) throws Exception {
//each server is listening on a dedicated broker
BrokerService broker = new BrokerService();
broker.setUseJmx(false);
broker.setPersistent(false);
broker.addConnector(url);
broker.start();

ActiveMQConfiguration configuration = new ActiveMQConfiguration();
configuration.setBrokerURL(url);
CamelContext camelContext = new DefaultCamelContext();
camelContext.addComponent("jms", new ActiveMQComponent(configuration));

camelContext.addRoutes(new RouteBuilder() {
public void configure() {
from("jms:queue:echo").bean(new Echo(){
public String echo(String text) {
return "Echo " + text + " from " + url;
}
});
}
});
camelContext.start();
}

//server interface
public static interface Echo{
String echo(String text);
}
}


Pom file

http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
4.0.0
test
jmsproblem
jar
1.0-SNAPSHOT
jmsproblem



org.apache.camel
camel-core
2.0.0


org.apache.camel
camel-jms
2.0.0


org.apache.activemq
activemq-camel
5.3.0





On Nov 21, 2009, at 1:26 AM, Claus Ibsen wrote:

> On Sat, Nov 21, 2009 at 7:18 AM, Ming Fang  wrote:
>> Does anyone know of a fix for this?
>> This is a critical problem for us, and for many I would think since this is 
>> a very typical configuration.
>> 
> 
> Have you asked /searched at the AMQ forum also?
> 
> Try creating a small application that demonstrates your issue so its
> easier for others to try to reproduce the issue.
> And make that application as simple as possible so there are less
> moving parts to get confused by.
> 
> 
> 
>> On Nov 19, 2009, at 6:59 AM, Ming Fang wrote:
>> 
>>> Yes changing idelTimeOut in org.apache.activemq.pool.ConnectionPool to a 
>>> very large number would be a workaround.
>>> However I don't see anyway of doing that in 
>>> org.apache.activemq.camel.component.ActiveMQConfiguration.
>>> 
>>> But ultimately I think the way Camel uses JMS is just wrong;
>>> The use of a Requestor to listen for out messages will always be a problem 
>>> because it's not guarantee to be listening on the same broker as the 
>>> publisher.
>>> --ming
>>> 
>>> On Nov 19, 2009, at 4:42 AM, Willem Jiang wrote:
>>> 
 Hi,
 
 How about change the idle time of switching the broker ?
 
 If the idle time is larger than your application response time, you will 
 not get this kind trouble anymore.
 
 Willem
 
 Ming Fang wrote:
> Hi
> We're using Camel 2.0 with Activemq 5.3.
> Our app uses Camel jms remoting.
> It's connecting to two discrete ActiveMQ brokers using the failover 
> transport randomly. Everything works fine at first.
> The problem happens when the app is idle for more than 30 seconds. After 
> that any remote call will trigger Activ

Quartz dependency missing for 1.6.6

2009-11-21 Thread huntc

Hi guys,

I'm attempting to build against the 2.1-SNAPSHOT at the moment and
experience:

Missing indirectly referenced artifact opensymphony:quartz:jar:1.6.6:compile

I see that 1.6.6 is a fairly new release and may not yet have made it to any
well known repos. Any advice on this?

Kind regards,
Christopher
-- 
View this message in context: 
http://old.nabble.com/Quartz-dependency-missing-for-1.6.6-tp26462662p26462662.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



Re: Original message body lost in transacted route

2009-11-21 Thread Claus Ibsen
Hi

I have created a ticket as I found a bug in Camel when you mix and
match transacted routes with Camel redelivery.
https://issues.apache.org/activemq/browse/CAMEL-2208

See my unit tests in this commit log:
http://svn.apache.org/viewvc?rev=882870&view=rev



On Sat, Nov 21, 2009 at 12:15 AM, Dragisa Krsmanovic
 wrote:
> I have a transacted route and onException clause that tells Camel to use
> original body on redelivery.
>
> If I modify body somewhere in the route, I am expecting to still receive
> original body on redelivery.
>
> That works fine if I do something like setBody(constant("xyz")), but if
> I use setBody(bean("somebean")) or to("bean:somebean") the body seems to
> be lost.
>
> Happens both in 2.1-SNAPSHOT and 2.0.0
>
> Here is unit test:
>
>
> = OnExceptionTest-context.xml ==
>
> http://www.springframework.org/schema/beans";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xmlns:amq="http://activemq.apache.org/schema/core";
>       xsi:schemaLocation="
>       http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>       http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
>       http://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd";>
>
>  
>  http://activemq.apache.org/schema/core"; useJmx="false"
> persistent="false" id="activeMQBroker">
>    
>      
>    
>  
>
>  
>   class="org.apache.activemq.ActiveMQConnectionFactory"
> depends-on="activeMQBroker">
>    
>  
>
>  
>   class="org.springframework.jms.connection.JmsTransactionManager">
>    
>  
>
>  
>  
>   class="org.apache.activemq.camel.component.ActiveMQComponent">
>    
>    
>    
>    
>    
>  
>
>  
>
>  http://camel.apache.org/schema/spring";>
>    
>  
>
> 
>
>
> = OnExceptionTest.java ==
>
>
> package org.apache.camel;
>
> import
> org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
> import org.springframework.test.context.ContextConfiguration;
> import org.springframework.test.annotation.DirtiesContext;
> import org.apache.camel.spring.SpringRouteBuilder;
> import org.apache.camel.component.mock.MockEndpoint;
> import org.testng.annotations.Test;
>
> /**
>  * @author Dragisa Krsmanovic
>  */
> @ContextConfiguration
> public class OnExceptionTest extends AbstractTestNGSpringContextTests {
>
> �...@endpointinject(uri = "mock:end")
>  protected MockEndpoint endpoint;
>
> �...@endpointinject(uri = "mock:error")
>  protected MockEndpoint error;
>
> �...@endpointinject(uri = "mock:checkpoint")
>  protected MockEndpoint checkpoint;
>
> �...@produce(uri = "activemq:start")
>  protected ProducerTemplate start;
>
> �...@produce(uri = "activemq:broken")
>  protected ProducerTemplate broken;
>
>
> �...@test
> �...@dirtiescontext
>  public void testWithBean() throws InterruptedException {
>    endpoint.expectedMessageCount(0);
>    error.expectedMessageCount(1);
>    checkpoint.expectedMessageCount(3);
>
>    checkpoint.allMessages().body().isEqualTo("foo");
>
>    broken.sendBody("foo");
>
>    checkpoint.assertIsSatisfied();
>    error.assertIsSatisfied();
>    endpoint.assertIsSatisfied();
>  }
>
> �...@test
> �...@dirtiescontext
>  public void testWithConstant() throws InterruptedException {
>    endpoint.expectedMessageCount(0);
>    error.expectedMessageCount(1);
>    checkpoint.expectedMessageCount(3);
>
>    checkpoint.allMessages().body().isEqualTo("foo");
>
>    start.sendBody("foo");
>
>    checkpoint.assertIsSatisfied();
>    error.assertIsSatisfied();
>    endpoint.assertIsSatisfied();
>  }
>
>
>  public static class FooBean {
>   �...@handler
>    public String process(@Body String body) {
>      return "oh no";
>    }
>  }
>
>  public static class TestRoutes extends SpringRouteBuilder {
>
>   �...@override
>    public void configure() throws Exception {
>
>      onException(Exception.class)
>          .handled(true)
>          .useOriginalBody()
>          .maximumRedeliveries(2)
>          .to("mock:error");
>
>      from("activemq:broken")
>          .transacted()
>          .to("mock:checkpoint")
>          .setBody(bean("foo"))
>          .throwException(new Exception("boo"))
>          .to("mock:end");
>
>      from("activemq:start")
>          .transacted()
>          .to("mock:checkpoint")
>          .setBody(constant(""))
>          .throwException(new Exception("boo"))
>          .to("mock:end");
>
>    }
>  }
> }
>
>
> --
> Dragisa Krsmanovic
> Java Developer
> Public Library of Science
> http://www.plos.org
>
>
> --
> This email is confidential to the intended recipient. If you have received it 
> in error, please notify the

Re: Original message body lost in transacted route

2009-11-21 Thread Claus Ibsen
Hi

Digged a bit deeper and seems the issue is that the assertion on the
constant seems wrong as you set the body to an empty string.
Which then causes Camel to look into the backing JMS message where it
can find the "foo" body. Despite the body is "".

Seems as Camel in the setBody should also set a DefaultMessage to
prevent still propagating specialized messages contains when you have
changed the body to something else.
Using this the backing JMS message will be gone and the "foo" message
is not present anymore.

The problem is that you want to use transacted routes and using Camel
redelivery policies, eg the stuff you do with onException.
What happens at runtime is that the message is NOT rolled back to the
JMS queue as Camel does local error handling. So after 2 errors its
just handled=true and moved to a mock.

And  .useOriginalBody() is only triggered when the message is moved to
the mock:error queue.




On Sat, Nov 21, 2009 at 12:15 AM, Dragisa Krsmanovic
 wrote:
> I have a transacted route and onException clause that tells Camel to use
> original body on redelivery.
>
> If I modify body somewhere in the route, I am expecting to still receive
> original body on redelivery.
>
> That works fine if I do something like setBody(constant("xyz")), but if
> I use setBody(bean("somebean")) or to("bean:somebean") the body seems to
> be lost.
>
> Happens both in 2.1-SNAPSHOT and 2.0.0
>
> Here is unit test:
>
>
> = OnExceptionTest-context.xml ==
>
> http://www.springframework.org/schema/beans";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xmlns:amq="http://activemq.apache.org/schema/core";
>       xsi:schemaLocation="
>       http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>       http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
>       http://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd";>
>
>  
>  http://activemq.apache.org/schema/core"; useJmx="false"
> persistent="false" id="activeMQBroker">
>    
>      
>    
>  
>
>  
>   class="org.apache.activemq.ActiveMQConnectionFactory"
> depends-on="activeMQBroker">
>    
>  
>
>  
>   class="org.springframework.jms.connection.JmsTransactionManager">
>    
>  
>
>  
>  
>   class="org.apache.activemq.camel.component.ActiveMQComponent">
>    
>    
>    
>    
>    
>  
>
>  
>
>  http://camel.apache.org/schema/spring";>
>    
>  
>
> 
>
>
> = OnExceptionTest.java ==
>
>
> package org.apache.camel;
>
> import
> org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
> import org.springframework.test.context.ContextConfiguration;
> import org.springframework.test.annotation.DirtiesContext;
> import org.apache.camel.spring.SpringRouteBuilder;
> import org.apache.camel.component.mock.MockEndpoint;
> import org.testng.annotations.Test;
>
> /**
>  * @author Dragisa Krsmanovic
>  */
> @ContextConfiguration
> public class OnExceptionTest extends AbstractTestNGSpringContextTests {
>
> �...@endpointinject(uri = "mock:end")
>  protected MockEndpoint endpoint;
>
> �...@endpointinject(uri = "mock:error")
>  protected MockEndpoint error;
>
> �...@endpointinject(uri = "mock:checkpoint")
>  protected MockEndpoint checkpoint;
>
> �...@produce(uri = "activemq:start")
>  protected ProducerTemplate start;
>
> �...@produce(uri = "activemq:broken")
>  protected ProducerTemplate broken;
>
>
> �...@test
> �...@dirtiescontext
>  public void testWithBean() throws InterruptedException {
>    endpoint.expectedMessageCount(0);
>    error.expectedMessageCount(1);
>    checkpoint.expectedMessageCount(3);
>
>    checkpoint.allMessages().body().isEqualTo("foo");
>
>    broken.sendBody("foo");
>
>    checkpoint.assertIsSatisfied();
>    error.assertIsSatisfied();
>    endpoint.assertIsSatisfied();
>  }
>
> �...@test
> �...@dirtiescontext
>  public void testWithConstant() throws InterruptedException {
>    endpoint.expectedMessageCount(0);
>    error.expectedMessageCount(1);
>    checkpoint.expectedMessageCount(3);
>
>    checkpoint.allMessages().body().isEqualTo("foo");
>
>    start.sendBody("foo");
>
>    checkpoint.assertIsSatisfied();
>    error.assertIsSatisfied();
>    endpoint.assertIsSatisfied();
>  }
>
>
>  public static class FooBean {
>   �...@handler
>    public String process(@Body String body) {
>      return "oh no";
>    }
>  }
>
>  public static class TestRoutes extends SpringRouteBuilder {
>
>   �...@override
>    public void configure() throws Exception {
>
>      onException(Exception.class)
>          .handled(true)
>          .useOriginalBody()
>          .maximumRedeliveries(2)
>          .to("mock:error");
>
>      from("activemq:broken")
>          .transacted()
>          .to("mock:checkpoint")
>          .setBody(bean("foo"))
>          .throwException(new Exception("boo"))
>          .to("m