Re: How does Camel work with ActiveMQ ?

2010-01-29 Thread BenXS

Ok, so I leave the  active and specified as camelContext in camel.xml
in activemq config dir:

http://camel.apache.org/schema/spring";>

  org.foo.bar 
  
 
   
   
 


In order to duplicate all incoming JMS msgs and put their clone into another
queue myqueue555 on the same MessageBroker.

Unfortunately when I sent now a message into myqueue123 then after a couple
of seconds the following error messages appear in ActiveMQ window and the
messages were NOT duplicated as intended.

Why?

 INFO | ActiveMQ WebConsole initialized.
 INFO | Initializing Spring FrameworkServlet 'dispatcher'
 INFO | ActiveMQ Console at http://0.0.0.0:8161/admin
 INFO | Initializing Spring root WebApplicationContext
 INFO | Connector vm://localhost Started
 INFO | Camel Console at http://0.0.0.0:8161/camel
 INFO | ActiveMQ Web Demos at http://0.0.0.0:8161/demo
 INFO | RESTful file access application at http://0.0.0.0:8161/fileserver
 INFO | Started selectchannelconnec...@0.0.0.0:8161
ERROR | org.apache.camel.ExchangeTimedOutException: The OUT message was not
received
within: 2 millis on the exchange: Exchange[JmsMessage:
ActiveMQTextMessage {commandId
= 5, responseRequired = true, messageId =
ID:AAA0001-1778-1264697336417-0:7:1:1:1,
originalDestination = null, originalTransactionId = null, producerId =
ID:AAA0001-1778-1264697336417-0:7:1:1, destination = queue://myqueue123,
transactionId = null, expiration = 0, timestamp = 1264698126199, arrival =
0, brokerInTime
= 1264698126199, brokerOutTime = 1264698126292, correlationId =
990020100128180206199,
replyTo = queue://myqueue555, persistent = true, type = Text, priority = 4,
groupID = null, groupSequence = 0, targetConsumerId = null, compressed =
false, userID =
null, content = null, marshalledProperties =
org.apache.activemq.util.byteseque...@16c02df, dataStructure = null,
redeliveryCounter =
0, size = 4076, properties = {msgselectr=10}, readOnlyProperties = true,
readOnlyBo
dy = true, droppable = false, text = }]
org.apache.camel.RuntimeCamelException:
org.apache.camel.ExchangeTimedOutException: The
OUT message was not received within: 2 millis on the exchange:
Exchange[JmsMessage:
ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId =
ID:AAA0001-1778-1264697336417-0:7:1:1:1, originalDestination = null,
originalTransactionId = null, producerId =
ID:AAA0001-1778-1264697336417-0:7:1:1,
destination = queue://myqueue123, transactionId = null, expiration = 0,
timestamp = 1264698126199, arrival = 0, brokerInTime = 1264698126199,
brokerOutTime =
1264698126292, correlationId = 990020100128180206199, replyTo =
queue://myqueue555, persistent = true, type = Text, priority = 4, groupID =
null, groupSequence = 0, targetConsumerId = null, compressed = false, userID
= null,
content = null, marshalledProperties =
org.apache.activemq.util.byteseque...@16c02df,
dataStructure = null, redeliveryCounter = 0, size = 4076, properties =
{msgselectr=10}, readO
nlyProperties = true, readOnlyBody = true, droppable = false, text =
}]
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1011)
at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.j
ava:103)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(Abstrac
tMessageListenerContainer.java:543)
at
-- 
View this message in context: 
http://old.nabble.com/How-does-Camel-work-with-ActiveMQ---tp27311853p27369931.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



Re: recipientList + AggregationStrategy

2010-01-29 Thread mcrive

Hi Claus,
having a way to retrieve transfer time to an endpoint (FTP mostly) is key
feature of the application I am writing (as a part of a bigger software
system).
You told me I should consider consultancy, can you give me any direction?
Who should I contact?


mcrive wrote:
> 
> If you need to have people creating such a sample then consider
> looking for consultancy.
> 

-- 
View this message in context: 
http://old.nabble.com/recipientList-%2B-AggregationStrategy-tp27305176p27370252.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: How does Camel work with ActiveMQ ?

2010-01-29 Thread Claus Ibsen
On Fri, Jan 29, 2010 at 11:32 AM, BenXS  wrote:
>
> Ok, so I leave the  active and specified as camelContext in camel.xml
> in activemq config dir:
>
> http://camel.apache.org/schema/spring";>
> 
>  org.foo.bar
>  
>  
>  
>  
>  
> 
>
> In order to duplicate all incoming JMS msgs and put their clone into another
> queue myqueue555 on the same MessageBroker.
>
> Unfortunately when I sent now a message into myqueue123 then after a couple
> of seconds the following error messages appear in ActiveMQ window and the
> messages were NOT duplicated as intended.

You are not duplicating messages, you are routing them. That is the
way JMS works.
When you consume a message from a queue its being removed from that
queue. JMS do not do copies per see.

And about that exception. Its because your JMS message on the Queue
have a JMSReplyTo set which makes Camel use request/reply over JMS.
You can use option disableReplyTo=true when on the  endpoint to
ignore JMSReplyTo.


>
> Why?
>
>  INFO | ActiveMQ WebConsole initialized.
>  INFO | Initializing Spring FrameworkServlet 'dispatcher'
>  INFO | ActiveMQ Console at http://0.0.0.0:8161/admin
>  INFO | Initializing Spring root WebApplicationContext
>  INFO | Connector vm://localhost Started
>  INFO | Camel Console at http://0.0.0.0:8161/camel
>  INFO | ActiveMQ Web Demos at http://0.0.0.0:8161/demo
>  INFO | RESTful file access application at http://0.0.0.0:8161/fileserver
>  INFO | Started selectchannelconnec...@0.0.0.0:8161
> ERROR | org.apache.camel.ExchangeTimedOutException: The OUT message was not
> received
> within: 2 millis on the exchange: Exchange[JmsMessage:
> ActiveMQTextMessage {commandId
> = 5, responseRequired = true, messageId =
> ID:AAA0001-1778-1264697336417-0:7:1:1:1,
> originalDestination = null, originalTransactionId = null, producerId =
> ID:AAA0001-1778-1264697336417-0:7:1:1, destination = queue://myqueue123,
> transactionId = null, expiration = 0, timestamp = 1264698126199, arrival =
> 0, brokerInTime
> = 1264698126199, brokerOutTime = 1264698126292, correlationId =
> 990020100128180206199,
> replyTo = queue://myqueue555, persistent = true, type = Text, priority = 4,
> groupID = null, groupSequence = 0, targetConsumerId = null, compressed =
> false, userID =
> null, content = null, marshalledProperties =
> org.apache.activemq.util.byteseque...@16c02df, dataStructure = null,
> redeliveryCounter =
> 0, size = 4076, properties = {msgselectr=10}, readOnlyProperties = true,
> readOnlyBo
> dy = true, droppable = false, text =         si1:schem...frametype>}]
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.ExchangeTimedOutException: The
> OUT message was not received within: 2 millis on the exchange:
> Exchange[JmsMessage:
> ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId =
> ID:AAA0001-1778-1264697336417-0:7:1:1:1, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:AAA0001-1778-1264697336417-0:7:1:1,
> destination = queue://myqueue123, transactionId = null, expiration = 0,
> timestamp = 1264698126199, arrival = 0, brokerInTime = 1264698126199,
> brokerOutTime =
> 1264698126292, correlationId = 990020100128180206199, replyTo =
> queue://myqueue555, persistent = true, type = Text, priority = 4, groupID =
> null, groupSequence = 0, targetConsumerId = null, compressed = false, userID
> = null,
> content = null, marshalledProperties =
> org.apache.activemq.util.byteseque...@16c02df,
> dataStructure = null, redeliveryCounter = 0, size = 4076, properties =
> {msgselectr=10}, readO
> nlyProperties = true, readOnlyBody = true, droppable = false, text =
>         si1:schem...frametype>}]
>        at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1011)
>        at
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.j
> ava:103)
>        at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(Abstrac
> tMessageListenerContainer.java:543)
>        at
> --
> View this message in context: 
> http://old.nabble.com/How-does-Camel-work-with-ActiveMQ---tp27311853p27369931.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: Aggregator's not returning combined exchanges, only returns last exchange

2010-01-29 Thread lekkie

Quite sorry for the trouble.

It seems AggregatorStrategy might be the wrong EIP to use for my business
case. I ran your sample and I just edited it to adapt it, and I am still not
getting desired result. 

Here is what I'd like to achieve:

Client Request -> remote WebService 1 -> remote webservice 1's reponse ->
(client request + remote webservice response) -> remote webservice 2 ->
remote webservice 2's response.

Someone made mention of content enricher, is that more appropriate for this
scenario?

See the edited script:


http://camel.apache.org/schema/spring";
trace="true">

http://0.0.0.0:9001/kimonoservice?matchOnUriPrefix=true";
/>

 


http://services.locator/}TerminalServicesService:TerminalServicesPort"/>
   
  







true











And here is the print out on my console:

22:31:59,421 | INFO  | 19967...@qtp9-1  | Tracer   |
rg.apache.camel.processor.Logger   88 | 04a712d3-a734-4391-abf7-b42dc22e2629
>>> (route8) xslt://requestToSOAP.xsl --> wireTap(direct://tap) <<<
Pattern:InOut, Headers:{CamelHttpResponseCode=200, Date=Thu, 28 Jan 2010
21:31:59 GMT}, BodyType:String, Body:
http://schemas.xmlsoap.org/soap/envelope/";>


purchase

9:23:58
M25155336EUH
N/A
EN


230
current





22:31:59,421 | INFO  | 19967...@qtp9-1  | Tracer   |
rg.apache.camel.processor.Logger   88 | 04a712d3-a734-4391-abf7-b42dc22e2629
>>> (route8) wireTap(direct://tap) -->
xslt://KXMLRequestToTerminalManagerRequest.xsl <<< Pattern:InOut,
Headers:{CamelHttpResponseCode=200, Date=Thu, 28 Jan 2010 21:31:59 GMT},
BodyType:String, Body:
http://schemas.xmlsoap.org/soap/envelope/";>


purchase

9:23:58
M25155336EUH
N/A
EN


230
current





22:31:59,421 | INFO  | ap[direct://tap] | Tracer   |
rg.apache.camel.processor.Logger   88 | 29e418ed-d5bc-49b9-99cc-d0f1deee5b4b
>>> (route9) from(http://0.0.0.0:9001/kimonoservice) --> aggregate[true] <<<
Pattern:InOnly, Headers:{Date=Thu, 28 Jan 2010 21:31:59 GMT,
CamelHttpResponseCode=200}, BodyType:String, Body:
http://schemas.xmlsoap.org/soap/envelope/";>


purchase

9:23:58
M25155336EUH
N/A
EN


230
current





22:31:59,437 | INFO  | 19967...@qtp9-1  | Tracer   |
rg.apache.camel.processor.Logger   88 | 04a712d3-a734-4391-abf7-b42dc22e2629
>>> (route8) xslt://KXMLRequestToTerminalManagerRequest.xsl -->  <<<
Pattern:InOut, Headers:{CamelHttpResponseCode=200, Date=Thu, 28 Jan 2010
21:31:59 GMT}, BodyType:String, Body:
http://schemas.xmlsoap.org/soap/envelope/";>

http://services.locator/";>
M25155336EUH
N/A

9:23:58




22:31:59,437 | INFO  | 19967...@qtp9-1  | Tracer   |
rg.apache.camel.processor.Logger   88 | 04a712d3-a734-4391-abf7-b42dc22e2629
>>> (route8)  -->
nmr://{http://services.locator/}TerminalServicesService:TerminalServicesPort
<<< Pattern:InOut, Headers:{Date=Thu, 28 Jan 2010 21:31:59 GMT,
CamelHttpResponseCode=200}, BodyType:javax.xml.transform.dom.DOMSource,
Body:http://schemas.xmlsoap.org/soap/envelope/";>

http://services.locator/";>
M25155336EUH
N/A

9:23:58



22:32:00,671 | INFO  | 19967...@qtp9-1  | Tracer   |
rg.apache.camel.processor.Logger   88 | 04a712d3-a734-4391-abf7-b42dc22e2629
>>> (route8)
nmr://{http://services.locator/}TerminalServicesService:TerminalServicesPort
-->  <<< Pattern:InOut, BodyType:javax.xml.transform.dom.DOMSource,
Body:http://schemas.xmlsoap.org/soap/envelope/";><_ns_:TerminalRequestResponse
xmlns:_ns_="http://services.locator/";>http://services.locator/";
type="locator.dto.TerminalResponse">-1Unknown
error
22:32:00,687 | INFO  | 19967...@qtp9-1  | Tracer   |
rg.apache.camel.processor.Logger   88 | 04a712d3-a734-4391-abf7-b42dc22e2629
>>> (route8)  --> xslt://TerminalResponseToKXMLRequest.xsl <<<
Pattern:InOut, BodyType:org.apache.camel.converter.jaxp.StringSource,
Body:http://schemas.xmlsoap.org/soap/envelope/";><_ns_:TerminalRequestResponse
xmlns:_ns_="http://services.locator/";>http://services.locator/";
type="locator.dto.TerminalResponse">-1Unknown
error
22:32:00,687 | INFO  | 19967...@qtp9-1  | Tracer   |
rg.apache.camel.processor.Logger   88 | 04a712d3-a734-4391-abf7-b42dc22e2629
>>> (route8) xslt://TerminalResponseToKXMLRequest.xsl --> direct://tap <<<
Pattern:InOut, BodyType:String, Body:
http://schemas.xmlsoap.org/soap/envelope/";>

http://services.locator/";>
-1
Unknown error




22:32:00,687 | INFO  | 19967...@qtp9-1  | Tracer   |
rg.apache.camel.processor.Logger   88 | 04a712d3-a734-4391-abf7-b42dc22e2629
>>> (route9) direct://tap --> aggregate[true] <<< Patter

Re: How does Camel work with ActiveMQ ?

2010-01-29 Thread BenXS

Ok, thank you.

So duplication is not possible with Camel at all?

Or is this route command only the wrong way to achieve this?

I need simply a way to log all incoming JMS msgs in a certain queue to
either
- another queue
or alternatively
- an own xml file

The JMS msg should be (beside the logging) normally consumed by another
process.

How should I setup such a  config command?

Ben


Claus Ibsen-2 wrote:
> 
> On Fri, Jan 29, 2010 at 11:32 AM, BenXS  wrote:
>>
>> Ok, so I leave the  active and specified as camelContext in
>> camel.xml
>> in activemq config dir:
>>
>> http://camel.apache.org/schema/spring";>
>> 
>>  org.foo.bar
>>  
>>  
>>  
>>  
>>  
>> 
>>
>> In order to duplicate all incoming JMS msgs and put their clone into
>> another
>> queue myqueue555 on the same MessageBroker.
>>
>> Unfortunately when I sent now a message into myqueue123 then after a
>> couple
>> of seconds the following error messages appear in ActiveMQ window and the
>> messages were NOT duplicated as intended.
> 
> You are not duplicating messages, you are routing them. That is the
> way JMS works.
> When you consume a message from a queue its being removed from that
> queue. JMS do not do copies per see.
> 
> And about that exception. Its because your JMS message on the Queue
> have a JMSReplyTo set which makes Camel use request/reply over JMS.
> You can use option disableReplyTo=true when on the  endpoint to
> ignore JMSReplyTo.
> 
> 
>>
>> Why?
>>
>>  INFO | ActiveMQ WebConsole initialized.
>>  INFO | Initializing Spring FrameworkServlet 'dispatcher'
>>  INFO | ActiveMQ Console at http://0.0.0.0:8161/admin
>>  INFO | Initializing Spring root WebApplicationContext
>>  INFO | Connector vm://localhost Started
>>  INFO | Camel Console at http://0.0.0.0:8161/camel
>>  INFO | ActiveMQ Web Demos at http://0.0.0.0:8161/demo
>>  INFO | RESTful file access application at http://0.0.0.0:8161/fileserver
>>  INFO | Started selectchannelconnec...@0.0.0.0:8161
>> ERROR | org.apache.camel.ExchangeTimedOutException: The OUT message was
>> not
>> received
>> within: 2 millis on the exchange: Exchange[JmsMessage:
>> ActiveMQTextMessage {commandId
>> = 5, responseRequired = true, messageId =
>> ID:AAA0001-1778-1264697336417-0:7:1:1:1,
>> originalDestination = null, originalTransactionId = null, producerId =
>> ID:AAA0001-1778-1264697336417-0:7:1:1, destination =
>> queue://myqueue123,
>> transactionId = null, expiration = 0, timestamp = 1264698126199, arrival
>> =
>> 0, brokerInTime
>> = 1264698126199, brokerOutTime = 1264698126292, correlationId =
>> 990020100128180206199,
>> replyTo = queue://myqueue555, persistent = true, type = Text, priority =
>> 4,
>> groupID = null, groupSequence = 0, targetConsumerId = null, compressed =
>> false, userID =
>> null, content = null, marshalledProperties =
>> org.apache.activemq.util.byteseque...@16c02df, dataStructure = null,
>> redeliveryCounter =
>> 0, size = 4076, properties = {msgselectr=10}, readOnlyProperties =
>> true,
>> readOnlyBo
>> dy = true, droppable = false, text = >        si1:schem...frametype>}]
>> org.apache.camel.RuntimeCamelException:
>> org.apache.camel.ExchangeTimedOutException: The
>> OUT message was not received within: 2 millis on the exchange:
>> Exchange[JmsMessage:
>> ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId =
>> ID:AAA0001-1778-1264697336417-0:7:1:1:1, originalDestination = null,
>> originalTransactionId = null, producerId =
>> ID:AAA0001-1778-1264697336417-0:7:1:1,
>> destination = queue://myqueue123, transactionId = null, expiration = 0,
>> timestamp = 1264698126199, arrival = 0, brokerInTime = 1264698126199,
>> brokerOutTime =
>> 1264698126292, correlationId = 990020100128180206199, replyTo =
>> queue://myqueue555, persistent = true, type = Text, priority = 4, groupID
>> =
>> null, groupSequence = 0, targetConsumerId = null, compressed = false,
>> userID
>> = null,
>> content = null, marshalledProperties =
>> org.apache.activemq.util.byteseque...@16c02df,
>> dataStructure = null, redeliveryCounter = 0, size = 4076, properties =
>> {msgselectr=10}, readO
>> nlyProperties = true, readOnlyBody = true, droppable = false, text =
>> >        si1:schem...frametype>}]
>>        at
>> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1011)
>>        at
>> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.j
>> ava:103)
>>        at
>> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(Abstrac
>> tMessageListenerContainer.java:543)
>>        at
>> --
>> View this message in context:
>> http://old.nabble.com/How-does-Camel-work-with-ActiveMQ---tp27311853p27369931.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:

Re: How does Camel work with ActiveMQ ?

2010-01-29 Thread Claus Ibsen
On Fri, Jan 29, 2010 at 12:30 PM, BenXS  wrote:
>
> Ok, thank you.
>
> So duplication is not possible with Camel at all?
>

Its the JMS Broker which may or may not offer such a feature to
duplicate/log whatever comes into it.
If using AMQ then try looking and asking at AMQ user forum.
Its just not a standard feature in JMS. Hence the different vendors
may have a custom solution for that.

If you use Camel to send the messages then you can of course let Camel
log a message before its send.

And spend some time googling what you want. It took me 5 sec to google
and find this link:
http://old.nabble.com/How-to-log-all-incoming-and-outgoing-JMS-msgs--td27307961.html


> Or is this route command only the wrong way to achieve this?
>
> I need simply a way to log all incoming JMS msgs in a certain queue to
> either
> - another queue
> or alternatively
> - an own xml file
>
> The JMS msg should be (beside the logging) normally consumed by another
> process.
>
> How should I setup such a  config command?
>
> Ben
>
>
> Claus Ibsen-2 wrote:
>>
>> On Fri, Jan 29, 2010 at 11:32 AM, BenXS  wrote:
>>>
>>> Ok, so I leave the  active and specified as camelContext in
>>> camel.xml
>>> in activemq config dir:
>>>
>>> http://camel.apache.org/schema/spring";>
>>> 
>>>  org.foo.bar
>>>  
>>>  
>>>  
>>>  
>>>  
>>> 
>>>
>>> In order to duplicate all incoming JMS msgs and put their clone into
>>> another
>>> queue myqueue555 on the same MessageBroker.
>>>
>>> Unfortunately when I sent now a message into myqueue123 then after a
>>> couple
>>> of seconds the following error messages appear in ActiveMQ window and the
>>> messages were NOT duplicated as intended.
>>
>> You are not duplicating messages, you are routing them. That is the
>> way JMS works.
>> When you consume a message from a queue its being removed from that
>> queue. JMS do not do copies per see.
>>
>> And about that exception. Its because your JMS message on the Queue
>> have a JMSReplyTo set which makes Camel use request/reply over JMS.
>> You can use option disableReplyTo=true when on the  endpoint to
>> ignore JMSReplyTo.
>>
>>
>>>
>>> Why?
>>>
>>>  INFO | ActiveMQ WebConsole initialized.
>>>  INFO | Initializing Spring FrameworkServlet 'dispatcher'
>>>  INFO | ActiveMQ Console at http://0.0.0.0:8161/admin
>>>  INFO | Initializing Spring root WebApplicationContext
>>>  INFO | Connector vm://localhost Started
>>>  INFO | Camel Console at http://0.0.0.0:8161/camel
>>>  INFO | ActiveMQ Web Demos at http://0.0.0.0:8161/demo
>>>  INFO | RESTful file access application at http://0.0.0.0:8161/fileserver
>>>  INFO | Started selectchannelconnec...@0.0.0.0:8161
>>> ERROR | org.apache.camel.ExchangeTimedOutException: The OUT message was
>>> not
>>> received
>>> within: 2 millis on the exchange: Exchange[JmsMessage:
>>> ActiveMQTextMessage {commandId
>>> = 5, responseRequired = true, messageId =
>>> ID:AAA0001-1778-1264697336417-0:7:1:1:1,
>>> originalDestination = null, originalTransactionId = null, producerId =
>>> ID:AAA0001-1778-1264697336417-0:7:1:1, destination =
>>> queue://myqueue123,
>>> transactionId = null, expiration = 0, timestamp = 1264698126199, arrival
>>> =
>>> 0, brokerInTime
>>> = 1264698126199, brokerOutTime = 1264698126292, correlationId =
>>> 990020100128180206199,
>>> replyTo = queue://myqueue555, persistent = true, type = Text, priority =
>>> 4,
>>> groupID = null, groupSequence = 0, targetConsumerId = null, compressed =
>>> false, userID =
>>> null, content = null, marshalledProperties =
>>> org.apache.activemq.util.byteseque...@16c02df, dataStructure = null,
>>> redeliveryCounter =
>>> 0, size = 4076, properties = {msgselectr=10}, readOnlyProperties =
>>> true,
>>> readOnlyBo
>>> dy = true, droppable = false, text = >>        si1:schem...frametype>}]
>>> org.apache.camel.RuntimeCamelException:
>>> org.apache.camel.ExchangeTimedOutException: The
>>> OUT message was not received within: 2 millis on the exchange:
>>> Exchange[JmsMessage:
>>> ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId =
>>> ID:AAA0001-1778-1264697336417-0:7:1:1:1, originalDestination = null,
>>> originalTransactionId = null, producerId =
>>> ID:AAA0001-1778-1264697336417-0:7:1:1,
>>> destination = queue://myqueue123, transactionId = null, expiration = 0,
>>> timestamp = 1264698126199, arrival = 0, brokerInTime = 1264698126199,
>>> brokerOutTime =
>>> 1264698126292, correlationId = 990020100128180206199, replyTo =
>>> queue://myqueue555, persistent = true, type = Text, priority = 4, groupID
>>> =
>>> null, groupSequence = 0, targetConsumerId = null, compressed = false,
>>> userID
>>> = null,
>>> content = null, marshalledProperties =
>>> org.apache.activemq.util.byteseque...@16c02df,
>>> dataStructure = null, redeliveryCounter = 0, size = 4076, properties =
>>> {msgselectr=10}, readO
>>> nlyProperties = true, readOnlyBody = true, droppable = false, text =
>>> >>        si1:schem...frametype>}]
>>>        at
>>> org.apache.camel.

Re: recipientList + AggregationStrategy

2010-01-29 Thread Claus Ibsen
On Fri, Jan 29, 2010 at 11:47 AM, mcrive  wrote:
>
> Hi Claus,
> having a way to retrieve transfer time to an endpoint (FTP mostly) is key
> feature of the application I am writing (as a part of a bigger software
> system).

There is a lot of stats in JMX, but since you use recipientList you
may want to filter that JMX stat to only be FTP related etc.

> You told me I should consider consultancy, can you give me any direction?
> Who should I contact?
>

You could ask at the Camel user forum for consultancy. There may be
people around wanting a gig.

Obviously there is my employer but we do not do small jobs, which may
be what you are on the lookout for.

But you are always welcome to contact them. There is a get support
button or a form to fill out under Contact Us:
http://fusesource.com/


On the other hand I have though of adding an event to the new
notification system in 2.2 to emit notifications for "send to
endpoint" which then could contain details such as endpoint and time
taken etc.

Then you could just register a notification listener and grab that
stats as they come flying in.






>
> mcrive wrote:
>>
>> If you need to have people creating such a sample then consider
>> looking for consultancy.
>>
>
> --
> View this message in context: 
> http://old.nabble.com/recipientList-%2B-AggregationStrategy-tp27305176p27370252.html
> Sent from the Camel - Users 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: How to update/remove camel route

2010-01-29 Thread Ricardo Melo
Hi ste,

Thank you for the response.

I'm developing a system where routes destination endpoint can be
added/updated/removed dynamically. A received XML message specifies the
operation, a route identifier name and the route destination endpoint
address. After this, the camel route from the camel context is
updated/removed. The routes are also present in a database, which have its
routes added/updated/removed from.

That's why I need to remove or update the route. Adding is pretty easy, but
for updating/removing I need to first find the route using the previously
specified address.

I've tried something like the code below, which is not working (the route is
not being updated for some reason. I'm using the setURI() method):

[CODE]

List routes = camelContext.getRouteDefinitions();

// Searches for the route to be updated
for( int i = 0 ; i < routes.size() ; i++ ) {

RouteDefinition routeToUpdate = routes.get(i);

/*
* Look for the correct route to update.
* The route to be updated is
* [FROM=activemq:queue:out_] -> [TO:]
*/

// Look for the route that starts with : [FROM=activemq:queue:out_]
if ( SearchUtil.find(
((FromDefinition) routeToUpdate.getInputs().get(0)).getLabel() ,
"out_" + newCommunicationRoute.getId() ) == true ) {

// Found! Update the destination. First stops the route, update it, then
restarts it
camelContext.stopRoute( routeToUpdate );

// Update destination [TO:]
((SendDefinition)
routeToUpdate.getOutputs().get(0)).setUri(
newConfiguration.getTransp() + newConfiguration.getParam());

// restart it
camelContext.startRoute( routeToUpdate );

[/CODE]

Strangely, the printed result of

(SendDefinition) routeToUpdate.getOutputs().get(0)

is differente from

((SendDefinition) routeToUpdate.getOutputs().get(0))
.getUri()
.

The getUri() returns something that seems not to be used, and the route is
not updated.

About the route removal, I didn't tried yet.

Thank you,
Ricardo






On Thu, Jan 28, 2010 at 6:32 PM, Stephen Gargan wrote:

> Ricardo,
>
> What are you trying to do? Are you trying to programmatically stop a
> route from processing by removing it? If so try specifying a
> RoutePolicy instead. If you can explain your intention a little more
> we can definitely suggest options.
>
> rgds,
>
> ste
>
> On Thu, Jan 28, 2010 at 10:37 AM, Ricardo Melo 
> wrote:
> > Hi,
> >
> > I'm new to camel API and I need to update or remove camel routes that
> have
> > been created.
> >
> > I've found in an example that to find current routes, I need to use the
> > code:
> > List routes = camelContext.getRouteDefinitions();
> >
> > I can iterate through the routes definition, however how can I see the
> "to"
> > (destination) endpoint of a route definition, to update or remove the
> route
> > I'm looking for? Where is it?
> >
> > Thanks in advance!
> > --
> > Ricardo Britto Melo
> >
> > CFlex - Empower your Decisions
> > Tel: (+55 19) 3251-5211
> > Rua Barão de Paranapanema, 401A
> > Campinas - SP
> > www.cflex.com.br
> >
>



-- 
Ricardo Britto Melo

CFlex - Empower your Decisions
Tel: (+55 19) 3251-5211
Rua Barão de Paranapanema, 401A
Campinas - SP
www.cflex.com.br


Re: recipientList + AggregationStrategy

2010-01-29 Thread mcrive

Hi,
the question have been made in this conversation but unfortunately only you
are replying me.
Maybe I am looking into a very particular thing...

It would be great if you can integrate such a feature in 2.2 (as I am
already running it)
I really appreciate your help, you already fix/enhanced Camel a lot
following my issues!!
That's the reason why I am on Camel 2.2 ;)

Is there a JIRA ticket where you mention such a feature? If so I will keep
an eye on it.

In the meantime I'll have a look to JMX to see if I can find a way to get
the piece of information I need.

Thanks again,
Marco



Claus Ibsen-2 wrote:
> 
> There is a lot of stats in JMX, but since you use recipientList you
> may want to filter that JMX stat to only be FTP related etc.
> 
>> You told me I should consider consultancy, can you give me any direction?
>> Who should I contact?
>>
> 
> You could ask at the Camel user forum for consultancy. There may be
> people around wanting a gig.
> 
> Obviously there is my employer but we do not do small jobs, which may
> be what you are on the lookout for.
> 
> But you are always welcome to contact them. There is a get support
> button or a form to fill out under Contact Us:
> http://fusesource.com/
> 
> 
> On the other hand I have though of adding an event to the new
> notification system in 2.2 to emit notifications for "send to
> endpoint" which then could contain details such as endpoint and time
> taken etc.
> 
> Then you could just register a notification listener and grab that
> stats as they come flying in.
> 
> 
> 
> 
> 
> 
>>
>> mcrive wrote:
>>>
>>> If you need to have people creating such a sample then consider
>>> looking for consultancy.
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/recipientList-%2B-AggregationStrategy-tp27305176p27370252.html
>> Sent from the Camel - Users 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/recipientList-%2B-AggregationStrategy-tp27305176p27371092.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: recipientList + AggregationStrategy

2010-01-29 Thread Claus Ibsen
On Fri, Jan 29, 2010 at 1:06 PM, mcrive  wrote:
>
> Hi,
> the question have been made in this conversation but unfortunately only you
> are replying me.

Well you have not said that you are looking for paid consultancy etc.

At the end I also have to draw a line somewhere. My family dont get
feed if nobody every in one way
or the other buys services from my employer. There is no such thing as
free lunch.

> Maybe I am looking into a very particular thing...
>

I have already laid out the answer in one of the earlier mails.
Just that if I have to write a specific sample for YOUR problem for
free is not something I can justify for my employer.

> It would be great if you can integrate such a feature in 2.2 (as I am
> already running it)
> I really appreciate your help, you already fix/enhanced Camel a lot
> following my issues!!
> That's the reason why I am on Camel 2.2 ;)
>
> Is there a JIRA ticket where you mention such a feature? If so I will keep
> an eye on it.
>

I have created a new ticket as I think it can make Camel better
https://issues.apache.org/activemq/browse/CAMEL-2429


> In the meantime I'll have a look to JMX to see if I can find a way to get
> the piece of information I need.
>


> Thanks again,
> Marco
>
>
>
> Claus Ibsen-2 wrote:
>>
>> There is a lot of stats in JMX, but since you use recipientList you
>> may want to filter that JMX stat to only be FTP related etc.
>>
>>> You told me I should consider consultancy, can you give me any direction?
>>> Who should I contact?
>>>
>>
>> You could ask at the Camel user forum for consultancy. There may be
>> people around wanting a gig.
>>
>> Obviously there is my employer but we do not do small jobs, which may
>> be what you are on the lookout for.
>>
>> But you are always welcome to contact them. There is a get support
>> button or a form to fill out under Contact Us:
>> http://fusesource.com/
>>
>>
>> On the other hand I have though of adding an event to the new
>> notification system in 2.2 to emit notifications for "send to
>> endpoint" which then could contain details such as endpoint and time
>> taken etc.
>>
>> Then you could just register a notification listener and grab that
>> stats as they come flying in.
>>
>>
>>
>>
>>
>>
>>>
>>> mcrive wrote:

 If you need to have people creating such a sample then consider
 looking for consultancy.

>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/recipientList-%2B-AggregationStrategy-tp27305176p27370252.html
>>> Sent from the Camel - Users 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
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/recipientList-%2B-AggregationStrategy-tp27305176p27371092.html
> Sent from the Camel - Users 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


JMS InOut issue

2010-01-29 Thread altoro

Hi all,

I'm having a problem with an application that was working fine and for some
reason, after the reboot of the server, stopped working... This application
is on one server that communicates with another server using Camel JMS. 
I have a server A from which I am sending message on a queue on server B.
The broker is embedded on server B using spring. My routes are defined using
DSL... 
If I'm sending the message with an Exchange.InOnly I have no problem: The
message is read on the queue by server B. When I'm sending it with an
Exchange.InOut, the message never gets to the server B, (I know that because
the log that follows the queue EndPoint is never displayed) and of course I
get a time out exception on the server A since no response is received.
The same code was working before and if I put it on a server C, both InOnly
and InOut exchange patterns work fine. As I know by checking the logs, the
message seems never to reach the targeted server when using InOut. (So the
problem is NOT that no message is set to be sent back as out message on
server B). 
I'm just wondering why... ? And also I can send a message from the server B
to the server A. That means the servers can reach each other. I'm running
out of idea! Please, if any one has an idea, I will really appreciate any
help because I'm really stuck here... 

Thanks in advance.

Arnaud.
-- 
View this message in context: 
http://old.nabble.com/JMS-InOut-issue-tp27372665p27372665.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Number of failed exchanges not shown in JConsole

2010-01-29 Thread ronP12

Is there anyway I can set an exception when it processes via the DLC?  If
there is an exception set or the exchange isn't marked as handled, the
number failed will increment.


willem.jiang wrote:
> 
> I don't find there are any counter in the DeadLetterChannel for counting 
> the failed exchange. But if you redirect the message to a activemq 
> queue, you can browser the Queue size from the Jconsole.
> 
> Willem
> ronP12 wrote:
>> Hi,
>> I'm using the deadLetterChannel to redirect messages to a queue if the
>> exchange fails.  I'm using JConsole to monitor the number completed, but,
>> it
>> does not show the number failed.  I understand the DLC handles the
>> exception
>> so I tried adding ".handled(false)" to my declaration but it doesn't have
>> any effect.
>> 
>> I want to see the correct number of failed exchanges in JConsole.  How do
>> I
>> do this?
>> 
>> 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Number-of-failed-exchanges-not-shown-in-JConsole-tp27359928p27372794.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Camel Route causes Serializable class not available to broker

2010-01-29 Thread SeanOD

Willem - thanks for the reply,

Currently we are using the camel 2.0.0 libraries that came bundled with
ActiveMQ 5.3 bundle.
I have put my message classes in the classpath of ActiveMQ and my routes now
work - but I am hoping not to be bound by this dependency.

Previously using ActiveMQ 5.2 bundled with camel 1.5 libraries we were able
to send any object to a queue and route via camel without that class being
on the classpath.

I was hoping that there may be an argument/configuration that would avoid
de-serializing the message in camel. 

-- 
View this message in context: 
http://old.nabble.com/Camel-Route-causes-Serializable-class-not-available-to-broker-tp27358773p27373089.html
Sent from the Camel - Users mailing list archive at Nabble.com.



ftp with seda problem

2010-01-29 Thread SwenVogel

Hi,

i created the following test route:

from("ftp://x...@192.168.89.150/test?password=&delete=true&delay=1";)
.to("seda:foo?timeout=6&concurrentConsumers=1");

from("seda:foo?timeout=6&concurrentConsumers=1")
.to("file:tmp");


When in the FTP folder are multiple files, most of the downloaded files in 
the local tmp folder has zero size!

This problem occurs not when i set "delete=false". More strange is that this
problem only exists under Linux not Windows!

Thanks...
-- 
View this message in context: 
http://old.nabble.com/ftp-with-seda-problem-tp27373947p27373947.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Keeping memory usage in check?

2010-01-29 Thread Kevin Jackson
Hi,

We have some large files which we have to process from an FTP server.
Currently we have to run camel with -Xmx2048m to allow these files to
process without camel failing with an (unreported) OutOfMemory error
(which we picked up with -XX:+HeapDumpOnOutOfMemoryError)

Reading the documentation points in the direction of not using the
default idempotent consumer[1].  I suppose I will have to use some
kind of JPA or filebased idempotent store - I don't like the idea of
this, so I'm trying to come  up with a way of avoiding it.

We currently have the following Spring route:


  



  
  



  
  
  


  


In this we are consuming a 100+Mb file in one gulp, then splitting and
streaming the generated objects to the db.  If I was to move the
splitter upstream:


  
  



  


Would this reduce the memory consumption?  This is just one of many
routes, and I'm concerned about the apparent wastefulness of camel at
the moment (although I'm fairly convinced that it's my config that is
incorrect).

[1]http://camel.apache.org/idempotent-consumer.html


Re: Keeping memory usage in check?

2010-01-29 Thread Claus Ibsen
Hi

Use the localWorkDirectory option on the FTP endpoint to stream from
FTP directly to files in a local work dir to avoid loading those big
files into memory.


On Fri, Jan 29, 2010 at 5:08 PM, Kevin Jackson  wrote:
> Hi,
>
> We have some large files which we have to process from an FTP server.
> Currently we have to run camel with -Xmx2048m to allow these files to
> process without camel failing with an (unreported) OutOfMemory error
> (which we picked up with -XX:+HeapDumpOnOutOfMemoryError)
>
> Reading the documentation points in the direction of not using the
> default idempotent consumer[1].  I suppose I will have to use some
> kind of JPA or filebased idempotent store - I don't like the idea of
> this, so I'm trying to come  up with a way of avoiding it.
>
> We currently have the following Spring route:
>
> 
>  
> 
>
> 
>  
>  
> 
>
> 
>  
>  
>  
>    
>    
>  
> 
>
> In this we are consuming a 100+Mb file in one gulp, then splitting and
> streaming the generated objects to the db.  If I was to move the
> splitter upstream:
>
> 
>  
>  
>    
>    
>    
>  
> 
>
> Would this reduce the memory consumption?  This is just one of many
> routes, and I'm concerned about the apparent wastefulness of camel at
> the moment (although I'm fairly convinced that it's my config that is
> incorrect).
>
> [1]http://camel.apache.org/idempotent-consumer.html
>



-- 
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: JMS InOut issue

2010-01-29 Thread Claus Ibsen
Hi

Get in touch with the JMS broker vendor and if you have support or
consultancy contract then use that to get access to people who can
help.

BTW when writing about a problem then you cant expect people to help
if you dont provide more details about the products used, os, versions
etc.



On Fri, Jan 29, 2010 at 3:23 PM, altoro  wrote:
>
> Hi all,
>
> I'm having a problem with an application that was working fine and for some
> reason, after the reboot of the server, stopped working... This application
> is on one server that communicates with another server using Camel JMS.
> I have a server A from which I am sending message on a queue on server B.
> The broker is embedded on server B using spring. My routes are defined using
> DSL...
> If I'm sending the message with an Exchange.InOnly I have no problem: The
> message is read on the queue by server B. When I'm sending it with an
> Exchange.InOut, the message never gets to the server B, (I know that because
> the log that follows the queue EndPoint is never displayed) and of course I
> get a time out exception on the server A since no response is received.
> The same code was working before and if I put it on a server C, both InOnly
> and InOut exchange patterns work fine. As I know by checking the logs, the
> message seems never to reach the targeted server when using InOut. (So the
> problem is NOT that no message is set to be sent back as out message on
> server B).
> I'm just wondering why... ? And also I can send a message from the server B
> to the server A. That means the servers can reach each other. I'm running
> out of idea! Please, if any one has an idea, I will really appreciate any
> help because I'm really stuck here...
>
> Thanks in advance.
>
> Arnaud.
> --
> View this message in context: 
> http://old.nabble.com/JMS-InOut-issue-tp27372665p27372665.html
> Sent from the Camel - Users 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: Camel Route causes Serializable class not available to broker

2010-01-29 Thread Claus Ibsen
Hi

Post the full stacktrace


On Thu, Jan 28, 2010 at 8:15 PM, SeanOD  wrote:
>
> Moving an application from ActiveMQ 5.2 to ActiveMQ 5.3, I am experiencing
> some difficulties with a camel route.  The route will only work now if I add
> the JMS object message classes to the classpath of ActiveMQ.
>
> The route was defined for the sole purpose of delaying the re-delivery a
> message back to a queue.
>
> In ActiveMQ 5.2 we defined as follows:
>   xmlns="http://activemq.apache.org/camel/schema/spring";>
>    
>      
>        
>          1
>          
>        
>    
>  
>
> I have tried to update this route for use with ActiveMQ 5.3 as such:
>
>    http://camel.apache.org/schema/spring";>
>        
>            
>                
>                    5000
>                
>            
>        
>    
>
> In ActiveMQ 5.3 without the message classes in the ActiveMQ classpath I get
> the following error:
> Execution of JMS message listener failed
> org.apache.camel.RuntimeCamelException: Failed to extract body due to:
> javax.jms.JMSException: Failed to build body from content. Serializable
> class not available to broker. Reason: java.lang.ClassNotFoundException:
>
> I have tried the jmsMapMessage=false parameter as well without any success.
> Am I now forced to make my message classes available for camel to route and
> delay ?
>
> Any help, suggestions would be appreciated.
>
> --
> View this message in context: 
> http://old.nabble.com/Camel-Route-causes-Serializable-class-not-available-to-broker-tp27358773p27358773.html
> Sent from the Camel - Users 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: How to update/remove camel route

2010-01-29 Thread Stephen Gargan
Ricardo,

What you're doing is very possible but you'll need to modify how you
are doing it. Routes are not really meant to be modified and restarted
like that, the setters are mostly for camel to initialize them in the
first place. Typically you use RouteBuilders to create and initialize
new Routes. Using the old RouteDefinition in a RouteBuilder to create
a new Route should give you what you need.

You are supplying each Route with is own id so, as Claus suggests, you
can use the methods on the CamelContext to stop the existing route.
Then use a RouteBuilder to create the new Route and add this back to
the context. The following test illustrates a basic solution.
Depending on how complex your route is, you'll need to do more work
when you create the new route from the old one. I suggest that you try
and keep this as simple as possible.

Give this a try and see how it works for you

rgds,

ste

public class DynamicRoutesTest extends CamelTestSupport {

@Test
public void routesCanBeCreatedDynamically() throws Exception {
MockEndpoint mock = setExpectedMessagesToMock("mock:out-endpoint", 1);

context.addRoutes(createDynamicRoute("dynamicRouteId",
"direct:in", "mock:out-endpoint"));

sendBody("direct:in", "payload to dynamic endpoint");

assertSatisfied(mock);
}

@Test
public void routesCanBeUpdatedDynamicallyToo() throws Exception {
// we're going to change the destination endpoint so the old
one should receive no exchanges and the new on one.
MockEndpoint oldDestination =
setExpectedMessagesToMock("mock:out-endpoint", 0);
MockEndpoint newDestination =
setExpectedMessagesToMock("mock:new-out-endpoint", 1);

context.addRoutes(createDynamicRoute("dynamicRouteId",
"direct:in", "mock:out-endpoint"));

//stop the route by its id
context.stopRoute("dynamicRouteId");

context.addRoutes(redirectTrafficToDifferentEndpoint("dynamicRouteId",
"mock:new-out-endpoint"));

sendBody("direct:in", "payload to dynamic endpoint");

assertSatisfied(oldDestination, newDestination);

}

public RouteBuilder createDynamicRoute(final String id, final
String uri, final String touri) {
return new RouteBuilder() {
public void configure() throws Exception {
from(uri).id(id).to(touri);
}
};
}

public RouteBuilder redirectTrafficToDifferentEndpoint(final
String id, final String newDestination) {
return new RouteBuilder() {
public void configure() throws Exception {
RouteDefinition old = getContext().getRouteDefinition(id);

for (FromDefinition from : old.getInputs()) {
from(from.getUri()).id(old.getId()).to(newDestination);
}
}
};
}

private MockEndpoint setExpectedMessagesToMock(String mockUri, int
expectedMessages) {
MockEndpoint mock = getMockEndpoint(mockUri);
mock.expectedMessageCount(expectedMessages);
return mock;
}

private void assertSatisfied(MockEndpoint... mocks) throws
InterruptedException {
for (MockEndpoint mock : mocks) {
mock.await(1, TimeUnit.SECONDS);
mock.assertIsSatisfied();
}
}
}

On Fri, Jan 29, 2010 at 3:52 AM, Ricardo Melo  wrote:
> Hi ste,
>
> Thank you for the response.
>
> I'm developing a system where routes destination endpoint can be
> added/updated/removed dynamically. A received XML message specifies the
> operation, a route identifier name and the route destination endpoint
> address. After this, the camel route from the camel context is
> updated/removed. The routes are also present in a database, which have its
> routes added/updated/removed from.
>
> That's why I need to remove or update the route. Adding is pretty easy, but
> for updating/removing I need to first find the route using the previously
> specified address.
>
> I've tried something like the code below, which is not working (the route is
> not being updated for some reason. I'm using the setURI() method):
>
> [CODE]
>
> List routes = camelContext.getRouteDefinitions();
>
> // Searches for the route to be updated
> for( int i = 0 ; i < routes.size() ; i++ ) {
>
> RouteDefinition routeToUpdate = routes.get(i);
>
> /*
> * Look for the correct route to update.
> * The route to be updated is
> * [FROM=activemq:queue:out_] -> [TO:]
> */
>
> // Look for the route that starts with : [FROM=activemq:queue:out_]
> if ( SearchUtil.find(
> ((FromDefinition) routeToUpdate.getInputs().get(0)).getLabel() ,
> "out_" + newCommunicationRoute.getId() ) == true ) {
>
> // Found! Update the destination. First stops the route, update it, then
> restarts it
> camelContext.stopRoute( routeToUpdate );
>
> // Update destination [TO:]
> ((SendDefinition)
> routeToUpdate.getOutputs().get(0)).setUri(
> newConfiguration.getTransp() + newConfiguration.getParam());
>
> // restart it
> camelCo

Re: Saxon for XSLT 2.0?

2010-01-29 Thread ychawla

Hello,
I need to use saxon as well as the XSLT transformer.  I just threw the saxon
jars in the classpath and the camel XSLT component used saxon.  I am using
Camel 2.1.0.

Cheers,
Yogesh


raulvk.soa wrote:
> 
> Hi,
> 
> Is there a possibility to use Saxon instead of Xalan when using the xslt:
> component? I need to use some XSLT/XPath 2.0 specific functions.
> 
> Where does Camel specify the XSLT implementation? I have tried looking at
> the system properties at runtime but I don't find any
> javax.xml.transform.TransformerFactory system property. (I am using Camel
> inside ServiceMix, does this have anything to do?).
> 
> Thanks.
> 

-- 
View this message in context: 
http://old.nabble.com/Saxon-for-XSLT-2.0--tp19557994p27376900.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



DBase Support?

2010-01-29 Thread James Carr
I know this sounds rather daft, but one legacy app we are integrating
with uses dBase as it's datastore and we need to process those files
daily... before I go and whip up my own endpoint for it to read them
in, is there already something available to read/write dbf files?


Thanks,
James


Re: How to update/remove camel route

2010-01-29 Thread Ricardo Melo
ste,

Thank you very much for the support. I'll try that solution. It's very
interesting, I have never used Mock endepoints.

In the meantime, I've tested a simple solution that worked: remove the
route, modify and add it again. :) For my needs, it worked well.

Thanks!
Ricardo



On Fri, Jan 29, 2010 at 5:05 PM, Stephen Gargan wrote:

> Ricardo,
>
> What you're doing is very possible but you'll need to modify how you
> are doing it. Routes are not really meant to be modified and restarted
> like that, the setters are mostly for camel to initialize them in the
> first place. Typically you use RouteBuilders to create and initialize
> new Routes. Using the old RouteDefinition in a RouteBuilder to create
> a new Route should give you what you need.
>
> You are supplying each Route with is own id so, as Claus suggests, you
> can use the methods on the CamelContext to stop the existing route.
> Then use a RouteBuilder to create the new Route and add this back to
> the context. The following test illustrates a basic solution.
> Depending on how complex your route is, you'll need to do more work
> when you create the new route from the old one. I suggest that you try
> and keep this as simple as possible.
>
> Give this a try and see how it works for you
>
> rgds,
>
> ste
>
> public class DynamicRoutesTest extends CamelTestSupport {
>
>@Test
>public void routesCanBeCreatedDynamically() throws Exception {
>MockEndpoint mock = setExpectedMessagesToMock("mock:out-endpoint",
> 1);
>
>context.addRoutes(createDynamicRoute("dynamicRouteId",
> "direct:in", "mock:out-endpoint"));
>
>sendBody("direct:in", "payload to dynamic endpoint");
>
>assertSatisfied(mock);
>}
>
>@Test
>public void routesCanBeUpdatedDynamicallyToo() throws Exception {
>// we're going to change the destination endpoint so the old
> one should receive no exchanges and the new on one.
>MockEndpoint oldDestination =
> setExpectedMessagesToMock("mock:out-endpoint", 0);
>MockEndpoint newDestination =
> setExpectedMessagesToMock("mock:new-out-endpoint", 1);
>
>context.addRoutes(createDynamicRoute("dynamicRouteId",
> "direct:in", "mock:out-endpoint"));
>
>//stop the route by its id
>context.stopRoute("dynamicRouteId");
>
>
>  context.addRoutes(redirectTrafficToDifferentEndpoint("dynamicRouteId",
> "mock:new-out-endpoint"));
>
>sendBody("direct:in", "payload to dynamic endpoint");
>
>assertSatisfied(oldDestination, newDestination);
>
>}
>
>public RouteBuilder createDynamicRoute(final String id, final
> String uri, final String touri) {
>return new RouteBuilder() {
>public void configure() throws Exception {
>from(uri).id(id).to(touri);
>}
>};
>}
>
>public RouteBuilder redirectTrafficToDifferentEndpoint(final
> String id, final String newDestination) {
>return new RouteBuilder() {
>public void configure() throws Exception {
>RouteDefinition old = getContext().getRouteDefinition(id);
>
>for (FromDefinition from : old.getInputs()) {
>from(from.getUri()).id(old.getId()).to(newDestination);
>}
>}
>};
>}
>
>private MockEndpoint setExpectedMessagesToMock(String mockUri, int
> expectedMessages) {
>MockEndpoint mock = getMockEndpoint(mockUri);
>mock.expectedMessageCount(expectedMessages);
>return mock;
>}
>
>private void assertSatisfied(MockEndpoint... mocks) throws
> InterruptedException {
>for (MockEndpoint mock : mocks) {
>mock.await(1, TimeUnit.SECONDS);
>mock.assertIsSatisfied();
> }
>}
> }
>
> On Fri, Jan 29, 2010 at 3:52 AM, Ricardo Melo 
> wrote:
> > Hi ste,
> >
> > Thank you for the response.
> >
> > I'm developing a system where routes destination endpoint can be
> > added/updated/removed dynamically. A received XML message specifies the
> > operation, a route identifier name and the route destination endpoint
> > address. After this, the camel route from the camel context is
> > updated/removed. The routes are also present in a database, which have
> its
> > routes added/updated/removed from.
> >
> > That's why I need to remove or update the route. Adding is pretty easy,
> but
> > for updating/removing I need to first find the route using the previously
> > specified address.
> >
> > I've tried something like the code below, which is not working (the route
> is
> > not being updated for some reason. I'm using the setURI() method):
> >
> > [CODE]
> >
> > List routes = camelContext.getRouteDefinitions();
> >
> > // Searches for the route to be updated
> > for( int i = 0 ; i < routes.size() ; i++ ) {
> >
> > RouteDefinition routeToUpdate = routes.get(i);
> >
> > /*
> > * Look for the correct route to update.
> > * The route to be updated is
> > * [FROM=activemq:queue:out_] -> [TO:]
> > */

Re: ftp with seda problem

2010-01-29 Thread SwenVogel

Would it possible that the content of the remote FTP files are not 
transfered to memory before the files are deleted by the
OnCompletitionStrategy?
-- 
View this message in context: 
http://old.nabble.com/ftp-with-seda-problem-tp27373947p27378068.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: JMS InOut issue

2010-01-29 Thread Willem Jiang
Please show your route and spring configure snippet, those will help us 
to dig the issue.


Willem

Claus Ibsen wrote:

Hi

Get in touch with the JMS broker vendor and if you have support or
consultancy contract then use that to get access to people who can
help.

BTW when writing about a problem then you cant expect people to help
if you dont provide more details about the products used, os, versions
etc.



On Fri, Jan 29, 2010 at 3:23 PM, altoro  wrote:

Hi all,

I'm having a problem with an application that was working fine and for some
reason, after the reboot of the server, stopped working... This application
is on one server that communicates with another server using Camel JMS.
I have a server A from which I am sending message on a queue on server B.
The broker is embedded on server B using spring. My routes are defined using
DSL...
If I'm sending the message with an Exchange.InOnly I have no problem: The
message is read on the queue by server B. When I'm sending it with an
Exchange.InOut, the message never gets to the server B, (I know that because
the log that follows the queue EndPoint is never displayed) and of course I
get a time out exception on the server A since no response is received.
The same code was working before and if I put it on a server C, both InOnly
and InOut exchange patterns work fine. As I know by checking the logs, the
message seems never to reach the targeted server when using InOut. (So the
problem is NOT that no message is set to be sent back as out message on
server B).
I'm just wondering why... ? And also I can send a message from the server B
to the server A. That means the servers can reach each other. I'm running
out of idea! Please, if any one has an idea, I will really appreciate any
help because I'm really stuck here...

Thanks in advance.

Arnaud.
--
View this message in context: 
http://old.nabble.com/JMS-InOut-issue-tp27372665p27372665.html
Sent from the Camel - Users mailing list archive at Nabble.com.










Re: How to update/remove camel route

2010-01-29 Thread Willem Jiang

Hi,

Camel provides lots of build blocks for testing, if you interest it here 
is the link[1].


[1]http://camel.apache.org/testing.html

Willem

Ricardo Melo wrote:

ste,

Thank you very much for the support. I'll try that solution. It's very
interesting, I have never used Mock endepoints.

In the meantime, I've tested a simple solution that worked: remove the
route, modify and add it again. :) For my needs, it worked well.

Thanks!
Ricardo



On Fri, Jan 29, 2010 at 5:05 PM, Stephen Gargan wrote:


Ricardo,

What you're doing is very possible but you'll need to modify how you
are doing it. Routes are not really meant to be modified and restarted
like that, the setters are mostly for camel to initialize them in the
first place. Typically you use RouteBuilders to create and initialize
new Routes. Using the old RouteDefinition in a RouteBuilder to create
a new Route should give you what you need.

You are supplying each Route with is own id so, as Claus suggests, you
can use the methods on the CamelContext to stop the existing route.
Then use a RouteBuilder to create the new Route and add this back to
the context. The following test illustrates a basic solution.
Depending on how complex your route is, you'll need to do more work
when you create the new route from the old one. I suggest that you try
and keep this as simple as possible.

Give this a try and see how it works for you

rgds,

ste

public class DynamicRoutesTest extends CamelTestSupport {

   @Test
   public void routesCanBeCreatedDynamically() throws Exception {
   MockEndpoint mock = setExpectedMessagesToMock("mock:out-endpoint",
1);

   context.addRoutes(createDynamicRoute("dynamicRouteId",
"direct:in", "mock:out-endpoint"));

   sendBody("direct:in", "payload to dynamic endpoint");

   assertSatisfied(mock);
   }

   @Test
   public void routesCanBeUpdatedDynamicallyToo() throws Exception {
   // we're going to change the destination endpoint so the old
one should receive no exchanges and the new on one.
   MockEndpoint oldDestination =
setExpectedMessagesToMock("mock:out-endpoint", 0);
   MockEndpoint newDestination =
setExpectedMessagesToMock("mock:new-out-endpoint", 1);

   context.addRoutes(createDynamicRoute("dynamicRouteId",
"direct:in", "mock:out-endpoint"));

   //stop the route by its id
   context.stopRoute("dynamicRouteId");


 context.addRoutes(redirectTrafficToDifferentEndpoint("dynamicRouteId",
"mock:new-out-endpoint"));

   sendBody("direct:in", "payload to dynamic endpoint");

   assertSatisfied(oldDestination, newDestination);

   }

   public RouteBuilder createDynamicRoute(final String id, final
String uri, final String touri) {
   return new RouteBuilder() {
   public void configure() throws Exception {
   from(uri).id(id).to(touri);
   }
   };
   }

   public RouteBuilder redirectTrafficToDifferentEndpoint(final
String id, final String newDestination) {
   return new RouteBuilder() {
   public void configure() throws Exception {
   RouteDefinition old = getContext().getRouteDefinition(id);

   for (FromDefinition from : old.getInputs()) {
   from(from.getUri()).id(old.getId()).to(newDestination);
   }
   }
   };
   }

   private MockEndpoint setExpectedMessagesToMock(String mockUri, int
expectedMessages) {
   MockEndpoint mock = getMockEndpoint(mockUri);
   mock.expectedMessageCount(expectedMessages);
   return mock;
   }

   private void assertSatisfied(MockEndpoint... mocks) throws
InterruptedException {
   for (MockEndpoint mock : mocks) {
   mock.await(1, TimeUnit.SECONDS);
   mock.assertIsSatisfied();
}
   }
}

On Fri, Jan 29, 2010 at 3:52 AM, Ricardo Melo 
wrote:

Hi ste,

Thank you for the response.

I'm developing a system where routes destination endpoint can be
added/updated/removed dynamically. A received XML message specifies the
operation, a route identifier name and the route destination endpoint
address. After this, the camel route from the camel context is
updated/removed. The routes are also present in a database, which have

its

routes added/updated/removed from.

That's why I need to remove or update the route. Adding is pretty easy,

but

for updating/removing I need to first find the route using the previously
specified address.

I've tried something like the code below, which is not working (the route

is

not being updated for some reason. I'm using the setURI() method):

[CODE]

List routes = camelContext.getRouteDefinitions();

// Searches for the route to be updated
for( int i = 0 ; i < routes.size() ; i++ ) {

RouteDefinition routeToUpdate = routes.get(i);

/*
* Look for the correct route to update.
* The route to be updated is
* [FROM=activemq:queue:out_] -> [TO:]
*/

// Look for the route that starts with :

[FROM=activemq:queue:out_]

if ( SearchUtil.find(
((FromDefinition) routeToUpdate.getInp

Re: DBase Support?

2010-01-29 Thread Willem Jiang

Hi,

AFAIK, there is no public camel component for dealing the dbf files.
You may need to implement yourself and please consider to contribute the 
code back to the camel community for the people who have the same 
requirement as you.


Willem

James Carr wrote:

I know this sounds rather daft, but one legacy app we are integrating
with uses dBase as it's datastore and we need to process those files
daily... before I go and whip up my own endpoint for it to read them
in, is there already something available to read/write dbf files?


Thanks,
James





Re: DBase Support?

2010-01-29 Thread James Carr
I'll give it a shot and contribute it back if I complete it. :)

On Fri, Jan 29, 2010 at 7:45 PM, Willem Jiang  wrote:
> Hi,
>
> AFAIK, there is no public camel component for dealing the dbf files.
> You may need to implement yourself and please consider to contribute the
> code back to the camel community for the people who have the same
> requirement as you.
>
> Willem
>
> James Carr wrote:
>>
>> I know this sounds rather daft, but one legacy app we are integrating
>> with uses dBase as it's datastore and we need to process those files
>> daily... before I go and whip up my own endpoint for it to read them
>> in, is there already something available to read/write dbf files?
>>
>>
>> Thanks,
>> James
>>
>
>


Re: JMS InOut issue

2010-01-29 Thread altoro

Hi Claus,

You're right! I should have given more details... And also right about the
fact 
I should have posted this on the activemq forum since the problem was
actually
related to the activemq broker. Sorry about that!

After invetigation I found out what the problem was:
The server A (see the first post) is running on a debian machine. The server
B is running 
on an Ubuntu machine. I'm using camel-jms and the camel-activemq component
to implement
the JMS communication between server A and B. 
After turning the activemq logs on the server B, I found out the message was
set as expired by 
the broker as soon as it arrives there. And the reason was that the time on
the server A was not
correct and one day earlier than the server B (stupid mistake!). 
After setting the correct time on the server A, everything works fine again. 
The strange thing is that if I put the broker on a server C running on a
Windows 7, there was no problem even with the time difference. Anyway, this
message should be on
the activemq user forum and not on the Camel one so I stop talking about
it... And sorry again for the 
wrong post.

Arnaud. 


Claus Ibsen-2 wrote:
> 
> Hi
> 
> Get in touch with the JMS broker vendor and if you have support or
> consultancy contract then use that to get access to people who can
> help.
> 
> BTW when writing about a problem then you cant expect people to help
> if you dont provide more details about the products used, os, versions
> etc.
> 
> 
> 
> On Fri, Jan 29, 2010 at 3:23 PM, altoro  wrote:
>>
>> Hi all,
>>
>> I'm having a problem with an application that was working fine and for
>> some
>> reason, after the reboot of the server, stopped working... This
>> application
>> is on one server that communicates with another server using Camel JMS.
>> I have a server A from which I am sending message on a queue on server B.
>> The broker is embedded on server B using spring. My routes are defined
>> using
>> DSL...
>> If I'm sending the message with an Exchange.InOnly I have no problem: The
>> message is read on the queue by server B. When I'm sending it with an
>> Exchange.InOut, the message never gets to the server B, (I know that
>> because
>> the log that follows the queue EndPoint is never displayed) and of course
>> I
>> get a time out exception on the server A since no response is received.
>> The same code was working before and if I put it on a server C, both
>> InOnly
>> and InOut exchange patterns work fine. As I know by checking the logs,
>> the
>> message seems never to reach the targeted server when using InOut. (So
>> the
>> problem is NOT that no message is set to be sent back as out message on
>> server B).
>> I'm just wondering why... ? And also I can send a message from the server
>> B
>> to the server A. That means the servers can reach each other. I'm running
>> out of idea! Please, if any one has an idea, I will really appreciate any
>> help because I'm really stuck here...
>>
>> Thanks in advance.
>>
>> Arnaud.
>> --
>> View this message in context:
>> http://old.nabble.com/JMS-InOut-issue-tp27372665p27372665.html
>> Sent from the Camel - Users 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/JMS-InOut-issue-tp27372665p27381433.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Identifying and processing changed file when noop=true

2010-01-29 Thread vjintegrates

I had tried this option it does not result in file being processed based on
timestamp. 

readLock=changed 

I believe this attribute is used to to check if the file can be locked or
not depending on last modified timestamp.

Changed file were processed automatically in Camel 1.x, once I upgraded to
2.x it stopped working, therefore I decided to provide the implementation of 
IdempotentRepository 



Claus Ibsen-2 wrote:
> 
> Hi
> 
> Have you tried the readLock=changed option?
> http://camel.apache.org/file2.html
> 
> 
> On Thu, Jan 28, 2010 at 4:01 PM, vjintegrates 
> wrote:
>>
>> I have added following implementation of IdempotentRepository to process
>> a
>> specific file from directory  when the file is modified. This is using
>> Camel
>> 2.x, Is there an alternative approach ?
>>
>> > uri="file:src/data?noop=true&idempotentRepository=#fileChanged&delay=30&fileName=myfile.txt"/>
>>
>> 
>>        
>> 
>>
>> public class FileChangedRepository implements
>> IdempotentRepository{
>>
>>        private String fileDir;
>>        private long lastModified =0;
>>
>>       �...@override
>>        public boolean add(String arg0) {
>>                return false;
>>        }
>>
>>       �...@override
>>        public boolean confirm(String arg0) {
>>                return true;
>>        }
>>
>>       �...@override
>>        public boolean contains(String arg0) {
>>                synchronized(this) {
>>                File file = new File(fileDir + File.separator + arg0);
>>
>>                if (file.lastModified() > lastModified) {
>>                        lastModified = file.lastModified();
>>                        return false;
>>                }
>>                return true;
>>               }
>>        }
>>
>>       �...@override
>>        public boolean remove(String arg0) {
>>                return false;
>>        }
>>
>>        public void setFileDir(String fileDir) {
>>                this.fileDir = fileDir;
>>        }
>>
>>        public String getFileDir() {
>>                return fileDir;
>>        }
>> }
>> --
>> View this message in context:
>> http://old.nabble.com/Identifying-and-processing-changed-file-when-noop%3Dtrue-tp27357357p27357357.html
>> Sent from the Camel - Users 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Identifying-and-processing-changed-file-when-noop%3Dtrue-tp27357357p27381562.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: JMS InOut issue

2010-01-29 Thread Claus Ibsen
Hi Arnaud


On Sat, Jan 30, 2010 at 5:59 AM, altoro  wrote:
>
> Hi Claus,
>
> You're right! I should have given more details... And also right about the
> fact
> I should have posted this on the activemq forum since the problem was
> actually
> related to the activemq broker. Sorry about that!
>

It's okay. Just that we want to get those facts before we start dig
into it. Often we know that problem X is resolved in version Y etc.

> After invetigation I found out what the problem was:
> The server A (see the first post) is running on a debian machine. The server
> B is running
> on an Ubuntu machine. I'm using camel-jms and the camel-activemq component
> to implement
> the JMS communication between server A and B.
> After turning the activemq logs on the server B, I found out the message was
> set as expired by
> the broker as soon as it arrives there. And the reason was that the time on
> the server A was not
> correct and one day earlier than the server B (stupid mistake!).
> After setting the correct time on the server A, everything works fine again.
> The strange thing is that if I put the broker on a server C running on a
> Windows 7, there was no problem even with the time difference. Anyway, this
> message should be on
> the activemq user forum and not on the Camel one so I stop talking about
> it... And sorry again for the
> wrong post.
>

Glad you got it resolved and posted back a description how to resolve it.
Yeah having a network of brokers requires that the server times is in sync.
Well in fact all your servers should be in sync with the time :)


> Arnaud.
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> Get in touch with the JMS broker vendor and if you have support or
>> consultancy contract then use that to get access to people who can
>> help.
>>
>> BTW when writing about a problem then you cant expect people to help
>> if you dont provide more details about the products used, os, versions
>> etc.
>>
>>
>>
>> On Fri, Jan 29, 2010 at 3:23 PM, altoro  wrote:
>>>
>>> Hi all,
>>>
>>> I'm having a problem with an application that was working fine and for
>>> some
>>> reason, after the reboot of the server, stopped working... This
>>> application
>>> is on one server that communicates with another server using Camel JMS.
>>> I have a server A from which I am sending message on a queue on server B.
>>> The broker is embedded on server B using spring. My routes are defined
>>> using
>>> DSL...
>>> If I'm sending the message with an Exchange.InOnly I have no problem: The
>>> message is read on the queue by server B. When I'm sending it with an
>>> Exchange.InOut, the message never gets to the server B, (I know that
>>> because
>>> the log that follows the queue EndPoint is never displayed) and of course
>>> I
>>> get a time out exception on the server A since no response is received.
>>> The same code was working before and if I put it on a server C, both
>>> InOnly
>>> and InOut exchange patterns work fine. As I know by checking the logs,
>>> the
>>> message seems never to reach the targeted server when using InOut. (So
>>> the
>>> problem is NOT that no message is set to be sent back as out message on
>>> server B).
>>> I'm just wondering why... ? And also I can send a message from the server
>>> B
>>> to the server A. That means the servers can reach each other. I'm running
>>> out of idea! Please, if any one has an idea, I will really appreciate any
>>> help because I'm really stuck here...
>>>
>>> Thanks in advance.
>>>
>>> Arnaud.
>>> --
>>> View this message in context:
>>> http://old.nabble.com/JMS-InOut-issue-tp27372665p27372665.html
>>> Sent from the Camel - Users 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
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/JMS-InOut-issue-tp27372665p27381433.html
> Sent from the Camel - Users 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: Identifying and processing changed file when noop=true

2010-01-29 Thread Claus Ibsen
On Sat, Jan 30, 2010 at 6:40 AM, vjintegrates  wrote:
>
> I had tried this option it does not result in file being processed based on
> timestamp.
>
> readLock=changed
>
> I believe this attribute is used to to check if the file can be locked or
> not depending on last modified timestamp.
>
> Changed file were processed automatically in Camel 1.x, once I upgraded to
> 2.x it stopped working, therefore I decided to provide the implementation of
> IdempotentRepository
>

readLock=change works in similar way as Camel 1.x file component.
It uses both file length and timestamp to detect whether or not the
file "changes" over time.

You can enable TRACE logging at
org.apache.camel.component.file.strategy to see how it detects this.

The idea is that in 2.x to move or delete the processed file
AFTERWARDS it has been processed to avoid reading it again.
In 1.x this was not the case as it has this internal idempotent repo
as well. If you really want to use that you can do it in 2.x as well.
Beware that if you restart the server how are you going to know that
you have already processed the file before?


>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> Have you tried the readLock=changed option?
>> http://camel.apache.org/file2.html
>>
>>
>> On Thu, Jan 28, 2010 at 4:01 PM, vjintegrates 
>> wrote:
>>>
>>> I have added following implementation of IdempotentRepository to process
>>> a
>>> specific file from directory  when the file is modified. This is using
>>> Camel
>>> 2.x, Is there an alternative approach ?
>>>
>>> >> uri="file:src/data?noop=true&idempotentRepository=#fileChanged&delay=30&fileName=myfile.txt"/>
>>>
>>> 
>>>        
>>> 
>>>
>>> public class FileChangedRepository implements
>>> IdempotentRepository{
>>>
>>>        private String fileDir;
>>>        private long lastModified =0;
>>>
>>>       �...@override
>>>        public boolean add(String arg0) {
>>>                return false;
>>>        }
>>>
>>>       �...@override
>>>        public boolean confirm(String arg0) {
>>>                return true;
>>>        }
>>>
>>>       �...@override
>>>        public boolean contains(String arg0) {
>>>                synchronized(this) {
>>>                File file = new File(fileDir + File.separator + arg0);
>>>
>>>                if (file.lastModified() > lastModified) {
>>>                        lastModified = file.lastModified();
>>>                        return false;
>>>                }
>>>                return true;
>>>               }
>>>        }
>>>
>>>       �...@override
>>>        public boolean remove(String arg0) {
>>>                return false;
>>>        }
>>>
>>>        public void setFileDir(String fileDir) {
>>>                this.fileDir = fileDir;
>>>        }
>>>
>>>        public String getFileDir() {
>>>                return fileDir;
>>>        }
>>> }
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Identifying-and-processing-changed-file-when-noop%3Dtrue-tp27357357p27357357.html
>>> Sent from the Camel - Users 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
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Identifying-and-processing-changed-file-when-noop%3Dtrue-tp27357357p27381562.html
> Sent from the Camel - Users 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