Ok, I've changed test to : 

...
    @Override
    protected CamelContext createCamelContext() throws Exception {
        CamelContext camelContext = super.createCamelContext();
        connectionFactory = new
ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
        manager.setConnectionFactory(connectionFactory);
        manager.setDefaultTimeout(3);
        configuration.setTransacted(true);
        configuration.setConnectionFactory(connectionFactory);
        configuration.setTransactionManager(manager);
        configuration.setTransactionTimeout(3);
            
        component.setConfiguration(configuration);             
        camelContext.addComponent("activemq", component);        
        return camelContext;
    }
    
    @Override
    
    
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {

                from("activemq:q1")
                  .process(new Processor() {
                    public void process(Exchange exchange) throws Exception
{
                        log.info("Before delayer  ");
                    }
                  })
                  .delayer(4000)
                  .process(new Processor() {
                    public void process(Exchange exchange) throws Exception
{
                        log.info("After delayer !!!!!!!!!!!!!!!! ");

                    }
                  })
                  .to("mock:empty");

            }
        };
    }

...

And also no timeout occurs


Claus Ibsen wrote:
> 
> Hi
> 
> If you use spring transaction (camel policy stuff) then it's in fact the
> backing transaction manager that handles all the stuff with delay,
> timeouts, number of retries etc.
> 
> James added some initial options in camel for setting some delays etc. but
> they are not fully implemented, and to my knowledge has a flaw in its
> delay handling somewhere - we have a ticket in JIRA for this.
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: Piotr Jagielski [mailto:[EMAIL PROTECTED] 
> Sent: 7. august 2008 10:47
> To: [email protected]
> Subject: Re: Servicemix/Camel problem - ToJbiProcessor hangs
> 
> 
> Gert,
> 
> I'm a bit confused with jms transaction timeout configuration. 
> My test is:
> ...
>     private TransactionTemplate transactionTemplate = new
> TransactionTemplate();
>     protected ConnectionFactory connectionFactory;
>     protected Policy required;
>     protected JmsComponent component = new JmsComponent();
>     
>     protected JmsConfiguration configuration = new JmsConfiguration(); 
>     protected JmsTransactionManager manager = new JmsTransactionManager();
> ...
>     @Override
>     protected CamelContext createCamelContext() throws Exception {
>         CamelContext camelContext = super.createCamelContext();
>         connectionFactory = new
> ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
>         manager.setConnectionFactory(connectionFactory);
>         configuration.setTransacted(true);
>         configuration.setConnectionFactory(connectionFactory);
>         configuration.setTransactionManager(manager);
>             
>         component.setConfiguration(configuration);
> 
>         camelContext.addComponent("activemq", component);
>         transactionTemplate.setTransactionManager(manager);
>         transactionTemplate.setTimeout(3);
>         required = new SpringTransactionPolicy(transactionTemplate);
>         
>         return camelContext;
>     }
>     
>     @Override
>     
>     
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             public void configure() throws Exception {
> 
>                 from("activemq:q1").policy(required)
>                   .process(new Processor() {
>                     public void process(Exchange exchange) throws
> Exception
> {
>                         log.info("Before delayer  ");
>                     }
>                   })
>                   .delayer(4000)
>                   .process(new Processor() {
>                     public void process(Exchange exchange) throws
> Exception
> {
>                         log.info("After delayer !!!!!!!!!!!!!!!! ");
> 
>                     }
>                   })
>                   .to("mock:empty");
> 
>             }
>         };
>     }
> ...
> 
> So I expect that timeout should occur and the mock:empty endpoint should
> be
> empty.
> But that never happens - 'After delayer' log is displayed and process
> completes.
> Setting defaultTimeout in transactionManager also didn't help...
> 
> Any ideas?
> 
> Regards,
> Piotr
> 
> 
> Gert Vanthienen wrote:
>> 
>> Piotr,
>> 
>> My guess was that the Camel component's thread pool was running out of 
>> threads. If it is, it wouldn't be showing in any of the components' 
>> stacktraces -- they would just be polling the DeliveryChannel for work 
>> like the ones you posted. Does your to("jbi:...") ever end up in another 
>> Camel routes (e.g. in one that starts with from("jbi:..." )-- if not, we 
>> can forget about the thread pool as a cause for your problems
>> alltogether...
>> 
>> You should be able to set the transaction timeout through the JMS 
>> endpoint as document on http://activemq.apache.org/camel/jms.html
>> 
>> Regards,
>> 
>> Gert
>> 
>> Piotr Jagielski wrote:
>>> Gert,
>>>
>>> In this case only camel jms listener thread hangs, other servicemix
>>> components threads are just waiting like:
>>>
>>> "pool-component.servicemix-http-thread-1" prio=1 tid=0x00002aaab8193500
>>> nid=0x4d97 waiting on condition [0x0000000047611000..0x0000000047611c40]
>>>         at sun.misc.Unsafe.park(Native Method)
>>>         at
>>> java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:146)
>>>         at
>>> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1803)
>>>         at
>>> java.util.concurrent.ArrayBlockingQueue.poll(ArrayBlockingQueue.java:286)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.accept(DeliveryChannelImpl.java:270)
>>>         at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle.pollDeliveryChannel(AsyncBaseLifeCycle.java:314)
>>>         at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle$1.run(AsyncBaseLifeCycle.java:300)
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>>         at java.lang.Thread.run(Thread.java:595)
>>>
>>> There is one pool-component-servicemix-http thread with stack like:
>>>
>>> "pool-component.servicemix-http-thread-1" prio=1 tid=0x00002aaab8193500
>>> nid=0x4d97 waiting on condition [0x0000000047611000..0x0000000047611c40]
>>>         at sun.misc.Unsafe.park(Native Method)
>>>         at
>>> java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:146)
>>>         at
>>> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1803)
>>>         at
>>> java.util.concurrent.ArrayBlockingQueue.poll(ArrayBlockingQueue.java:286)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.accept(DeliveryChannelImpl.java:270)
>>>         at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle.pollDeliveryChannel(AsyncBaseLifeCycle.java:314)
>>>         at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle$1.run(AsyncBaseLifeCycle.java:300)
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>>         at java.lang.Thread.run(Thread.java:595)
>>>
>>> Is it possible to recover from this by setting some timeout on jms
>>> transaction manager?
>>> My route definition is:
>>> from("activemq:queueA").policy(required)
>>>  .to("jbi:endpoint:B")
>>>
>>> Regards,
>>> Piotr
>>>
>>>
>>> Gert Vanthienen wrote:
>>>   
>>>> Piotr,
>>>>
>>>> I'm guessing that at some point, the message you sent to the jbi 
>>>> endpoint ends up in another Camel route.  ServiceMix has a thread pool 
>>>> per component, so in order to process the exchange in the second Camel 
>>>> route, it needs another thread from the pool, where all threads are 
>>>> already waiting on sendSync. 
>>>>
>>>> We should probably improve the servicemix-camel component to use send() 
>>>> instead of sendSync() whenever possible.  For now, you should try to 
>>>> increase the size of the thread pools by modifying 
>>>> conf/servicemix.properties (for a global increase of thread pool size) 
>>>> or by looking at http://servicemix.apache.org/thread-pools.html for a 
>>>> more targeted tuning.
>>>>
>>>> Regards,
>>>>
>>>> Gert
>>>>
>>>> Piotr Jagielski wrote:
>>>>     
>>>>> Hi,
>>>>>
>>>>> I have some servicemix-camel service unit which uses following route:
>>>>> jms queue -> jbi endpoint
>>>>>
>>>>> After launching some long-running tests, following error occured :
>>>>>
>>>>> Exception in thread "ActiveMQ Transport: tcp:///127.0.0.1:41368" 
>>>>> java.lang.ArrayIndexOutOfBoundsException: 28515
>>>>>       
>>>>>> ---at 
>>>>>>         
>>>>> org.apache.activemq.openwire.OpenWireFormat.getFromUnmarshallCache(OpenWireFormat.java:513)
>>>>>  
>>>>>
>>>>>       
>>>>>> ---at 
>>>>>>         
>>>>> org.apache.activemq.openwire.v2.BaseDataStreamMarshaller.tightUnmarsalCachedObject(BaseDataStreamMarshaller.java:137)
>>>>>  
>>>>>
>>>>>       
>>>>>> ---at 
>>>>>>         
>>>>> org.apache.activemq.openwire.v2.ConnectionInfoMarshaller.tightUnmarshal(ConnectionInfoMarshaller.java:69)
>>>>>  
>>>>>
>>>>>       
>>>>>> ---at 
>>>>>>         
>>>>> org.apache.activemq.openwire.OpenWireFormat.doUnmarshal(OpenWireFormat.java:347)
>>>>>  
>>>>>
>>>>>       
>>>>>> ---at 
>>>>>>         
>>>>> org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:273)
>>>>>  
>>>>>
>>>>>       
>>>>>> ---at 
>>>>>>         
>>>>> org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:156)
>>>>>  
>>>>>
>>>>>       
>>>>>> ---at 
>>>>>>         
>>>>> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:136)
>>>>>       
>>>>>> ---at java.lang.Thread.run(Thread.java:595)
>>>>>>         
>>>>> This exception is not itself a problem, but when i looked at thread 
>>>>> dump, it appeared that ToJbiProcessor hung on DeliveryChannel.sendSync
>>>>> :
>>>>>
>>>>> "DefaultMessageListenerContainer-1776" prio=1 tid=0x00002aaaaea39ee0 
>>>>> nid=0x4547 in Object.wait() [0x00000000539d3000..0x00000000539d4e40]
>>>>>        at java.lang.Object.wait(Native Method)
>>>>>        - waiting on <0x00002afd9884a428> (a 
>>>>> org.apache.servicemix.jbi.messaging.InOutImpl)
>>>>>        at 
>>>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.waitForExchange(DeliveryChannelImpl.java:699)
>>>>>  
>>>>>
>>>>>        at 
>>>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:472)
>>>>>  
>>>>>
>>>>>        - locked <0x00002afd9884a428> (a 
>>>>> org.apache.servicemix.jbi.messaging.InOutImpl)
>>>>>        at 
>>>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:442)
>>>>>  
>>>>>
>>>>>        at 
>>>>> org.apache.servicemix.camel.ToJbiProcessor.process(ToJbiProcessor.java:76)
>>>>>  
>>>>>
>>>>>        at 
>>>>> org.apache.servicemix.camel.JbiEndpoint$1.process(JbiEndpoint.java:46)
>>>>>        at
>>>>> org.apache.camel.util.ProducerCache.send(ProducerCache.java:67)
>>>>>        at org.apache.camel.CamelTemplate.send(CamelTemplate.java:107)
>>>>>        at org.apache.camel.CamelTemplate.send(CamelTemplate.java:57)
>>>>>
>>>>> Is it possible to set some timeout while calling 
>>>>> DeliveryChannel.sendSync?
>>>>> Or shall I set timeout on jms transaction manager to rollback whole 
>>>>> transaction? (How to do this?)
>>>>> Should I post this on servicemix-user too?
>>>>>
>>>>> Regards,
>>>>> Piotr
>>>>>
>>>>>       
>>>>
>>>> -----
>>>> ---
>>>> Gert Vanthienen
>>>> http://www.anova.be
>>>>
>>>>     
>>>
>>>   
>> 
>> 
>> 
>> -----
>> ---
>> Gert Vanthienen
>> http://www.anova.be
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Servicemix-Camel-problem---ToJbiProcessor-hangs-tp18651622s22882p18866389.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Servicemix-Camel-problem---ToJbiProcessor-hangs-tp18651622s22882p18866663.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to