Re: Need help in java.net.ConnectException: Connection refused

2012-06-14 Thread Babak Vahdat
Maybe this could be one possible way:

Using plain Java Socket API write a bean which only does try to connect on
localhost port 61616 inside your Camel route and rethrows the exception if
java.net.ConnectException with the message "Connection refused" is thrown so
that your onException clause get's kicked in.

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/Need-help-in-java-net-ConnectException-Connection-refused-tp5714476p5714526.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Need help in java.net.ConnectException: Connection refused

2012-06-14 Thread Babak Vahdat
Ah now I see the problem. The onException clause of yours  will not help at
all as Camel does NOT see / get the java.net.ConnectException thrown here. I
don't see any possible way of achieving what you're looking for! 

However in general there's a org.springframework.util.ErrorHandler which is
so to say the DMLC error handler/callback where you could provide your own
using:

JmsEndpoint.setErrorHandler()

Or:

JmsConfiguration.setErrorHandler()

Inside Java Code or Spring config but in this concrete case even using
ErrorHandler would not help. Following the code snippet from DMLC where the
exception is catched:

protected void refreshConnectionUntilSuccessful() {
while (isRunning()) {
try {
if (sharedConnectionEnabled()) {
refreshSharedConnection();
}
else {
Connection con = createConnection();
JmsUtils.closeConnection(con);
}
logger.info("Successfully refreshed JMS 
Connection");
break;
}
catch (Exception ex) {
StringBuilder msg = new StringBuilder();
msg.append("Could not refresh JMS Connection 
for destination '");

msg.append(getDestinationDescription()).append("' - retrying in ");
msg.append(this.recoveryInterval).append(" ms. 
Cause: ");
msg.append(ex instanceof JMSException ?
JmsUtils.buildExceptionMessage((JMSException) ex) : ex.getMessage());
if (logger.isDebugEnabled()) {
logger.warn(msg, ex);
}
else {
logger.warn(msg);
}
}
sleepInbetweenRecoveryAttempts();
}
}



That said maybe there're STILL a way of achieving what you need which others
in the forum could have in their mind, however I doubt that.

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/Need-help-in-java-net-ConnectException-Connection-refused-tp5714476p5714525.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Need help in java.net.ConnectException: Connection refused

2012-06-14 Thread vargjohn
Hi Babak,

I am using below camel exception clause inside the camel route.

onException(java.net.ConnectException.class).to("bean:localRouteHelper?method=handleException").end()

but still i keep getting the below exception sent from camel server.

WARNING: Could not refresh JMS Connection for destination 'mediation-mq' -
retrying in 5000 ms. Cause: Could not connect to broker URL:
tcp://localhost:61616. Reason: java.net.ConnectException: Connection
refused.

Any other method to resolve this exception. Please help.

Thanks & Regards,
John Varghese



--
View this message in context: 
http://camel.465427.n5.nabble.com/Need-help-in-java-net-ConnectException-Connection-refused-tp5714476p5714524.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: smtps unknown parameter sslContextParameters error

2012-06-14 Thread Claus Ibsen
On Thu, Jun 14, 2012 at 11:15 PM, paramjyotsingh
wrote:

> Hi,
>
> I am trying to use  smtps to send email. notification and getting following
> error.
>
> Unknown parameters=[{sslContextParameters=#sslContextParameters}]
>
> my configuration is:-
>
> 
>
> resource="C://java/jdk/jre/lib/security/cacerts"
>password="changeit" />
>
> 
>
> 
> uri="smtps://{{mail.smtp.host}}:{{mail.smtp.port}}/?sslContextParameters=#sslContextParameters&username={{mail.smtp.username}}&password={{mail.smtp.password}}&to={{mail.support_team_members}}&from={{mail.smtp.username}}"/>
>
> Am I doing something wrong, i got this parameter name from camel online
> documentation for Mail component.
>
>
The documentation states that you need Camel 2.10 for using
the sslContextParameters
http://camel.apache.org/mail.html

And Camel 2.10 has not been released yet.




> --
> View this message in context:
> http://camel.465427.n5.nabble.com/smtps-unknown-parameter-sslContextParameters-error-tp5714513.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: recipient list sending to multiple Camel Processors

2012-06-14 Thread Claus Ibsen
On Thu, Jun 14, 2012 at 9:58 PM, Tyler Durvik  wrote:

> Yes.  I want to dynamically build recipient list, but all the
> destinations will be camel processor.  I see examples where you parse
> a header using a comma (","), or a java.util.List of strings but not
> processors.  I am trying to build the list dynamically inside a bean.
>
>
If you enlist your processors in the registry, eg if you use Spring XML,
then define them as , then you can refer to them using the bean
component

return "bean:foo,bean:bar"





>
>
> On Thu, Jun 14, 2012 at 3:50 PM, Vincent Nonnenmacher
>  wrote:
> > you means this  is not what
> > you're looking for ?
> >
> >
> > On Thu, Jun 14, 2012 at 9:08 PM, Tyler Durvik 
> wrote:
> >
> >> Is it possible to send a message to a group of Camel processors using
> >> a recipient list ?  I have looked through the documentation and cannot
> >> find an example of this.
> >>
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


subscribe

2012-06-14 Thread Zerdo


smtps unknown parameter sslContextParameters error

2012-06-14 Thread paramjyotsingh
Hi,

I am trying to use  smtps to send email. notification and getting following
error.

Unknown parameters=[{sslContextParameters=#sslContextParameters}]

my configuration is:-

 



 



Am I doing something wrong, i got this parameter name from camel online
documentation for Mail component.

--
View this message in context: 
http://camel.465427.n5.nabble.com/smtps-unknown-parameter-sslContextParameters-error-tp5714513.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: One Camel Context with several XMLs

2012-06-14 Thread Claus Ibsen
On Thu, Jun 14, 2012 at 8:44 PM, Bruno Borges wrote:

> sweet, just what I needed... thanks claus
>
> It seems the docs are a little fuzzy. I spent like 10 min looking around
> but couldn't find this page.
>
>
We sure can use help on the docs.
http://camel.apache.org/contributing.html

For example creating new FAQs that can help people easier find the pages.
http://camel.apache.org/faq.html

Also make  sure to use the search box on the front page



> *Bruno Borges*
> (21) 7672-7099
> *www.brunoborges.com*
>
>
>
> On Thu, Jun 14, 2012 at 3:40 PM, Claus Ibsen 
> wrote:
>
> > On Thu, Jun 14, 2012 at 8:22 PM, Bruno Borges  > >wrote:
> >
> > > Is it possible to break a Camel Context accross several XML files?
> > >
> > >
> > See this page about using routeContext
> > http://camel.apache.org/configuring-camel.html
> >
> >
> >
> > > *Bruno Borges*
> > > (21) 7672-7099
> > > *www.brunoborges.com*
> > >
> >
> >
> >
> > --
> > Claus Ibsen
> > -
> > FuseSource
> > Email: cib...@fusesource.com
> > Web: http://fusesource.com
> > Twitter: davsclaus, fusenews
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> >
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Need help in java.net.ConnectException: Connection refused

2012-06-14 Thread Willem Jiang
It looks like the exception is throw before it is ready to consume the 
message. I doubt the ErrorHandler can do this work.

Maybe you should wrap the jms connector to catch this kind of error.

On 6/14/12 5:44 PM, vargjohn wrote:

Hi All,

I have an application which has a camel server running and listening to
activemq server at port number 61616.

When the camel server is running, the activemq server should also be running
at the same time to listen to the messages.

When the activemq is not started i am getting the below exception.

"Could not connect to broker URL: tcp://localhost:61616. Reason:
java.net.ConnectException: Connection refused"

Instead of showing the above exception, i need to show a meaningful message
to the user something like please restart the activemq server, how do i
achieve this, Can anyone give me a solution for this exception.

Thanks&  Regards,
John

--
View this message in context: 
http://camel.465427.n5.nabble.com/Need-help-in-java-net-ConnectException-Connection-refused-tp5714476.html
Sent from the Camel - Users mailing list archive at Nabble.com.




--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang


Re: CXFRS URL Matrix Parameters seemingly stripped away

2012-06-14 Thread Willem Jiang

Hi,

As Sergey just said, the metrix parameters are got from the request URI 
which means it has nothing to do with the server address that your 
camel-cxfrs consumer is using.
Even you define the server address with the values option, if the 
client request doesn't has these values you will not get it.

Please check if the request to the camel-cxfrs consumer is right.

On Fri Jun 15 00:19:15 2012, Sergey Beryozkin wrote:

Hi
On 14/06/12 16:59, desysemia wrote:

This is my first time posting here, so a big hello from me!

Let me start off by stating I'm quite new to Camel and CXF so the
issue I'm
seeing might well just be my own doing.

I'm currently running FuseESB/ServiceMix 3.6/4.4.1 including Camel
version
2.8.0.

The short version:

is that the PathSegment.getMatrixParameters method returns an empty
collection if the resource is accessed through the URL made available
through the rsServer endpoint, but as expected when accessed through the
rsClient endpoint. But therefore as I understand it not therefore
using the
Camel route at all.

So to me somewhere along the line Camel/CXF is stripping of the matrix
parameters, thoughts?



In CXF alone, HTTPServletRequest.getRequestURI() is used in CXF
AbstractHTTPDestination to capture the relative path including the
matrix parameters if any, for the subsequent match to succeed.

I've confirmed locally that matrix parameters are correctly captured
with the nearly identical test resource method signature.

Perhaps in your case CXF Message.REQUEST_URI property is set by CXF
Camel differently which may be causing the loss of the parameters

Cheers, Sergey


The long version:

So here goes with the scenario;

I have a Camel route defined using the rsServer and rsClient
endpoints, and
I have a resource class implemented and used by both endpoints with a
single
JAXRS annotated method as such;

@GET
@Path ( "object/{context}/{version}" )
public String getObject ( @PathParam ( "context" ) PathSegment context,
@PathParam ( "version" ) float version );

This is invoked through the rsServer endpoint URL like so;

http://localhost:9000/test/object/id;key1=value1;key2=value2/1.0

Then calling the getMatrixParameters method on the 'context' parameter
returns an empty collection.

However if this is invoked through the rsClient endpoint URL like so;

http://localhost:9001/test/object/id;key1=value1;key2=value2/1.0

Then calling the getMatrixParameters method on the 'context' parameter
returns a collection containing the two key/value pairs as described.

Hopefully someone out there can point me in the right direction here?

Thanks in advance.

D.


--
View this message in context:
http://camel.465427.n5.nabble.com/CXFRS-URL-Matrix-Parameters-seemingly-stripped-away-tp5714486.html

Sent from the Camel - Users mailing list archive at Nabble.com.







--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang



Re: recipient list sending to multiple Camel Processors

2012-06-14 Thread Christian Schneider
The recipientlist dsl element only can work with a list of endpoint 
uris. How else should it address them.

How should that work with processors?

When you build the processors in your bean how do you model them ?
As List or similar?

In this case why don´t you simply call each processor in the bean?

Christian

Am 14.06.2012 21:58, schrieb Tyler Durvik:

Yes.  I want to dynamically build recipient list, but all the
destinations will be camel processor.  I see examples where you parse
a header using a comma (","), or a java.util.List of strings but not
processors.  I am trying to build the list dynamically inside a bean.




On Thu, Jun 14, 2012 at 3:50 PM, Vincent Nonnenmacher
  wrote:

you means this  is not what
you're looking for ?


On Thu, Jun 14, 2012 at 9:08 PM, Tyler Durvik  wrote:


Is it possible to send a message to a group of Camel processors using
a recipient list ?  I have looked through the documentation and cannot
find an example of this.




--

Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com



Re: HTTP4 component cannot resolve DNS

2012-06-14 Thread Christian Müller
Camel-http4 leverages on Apache commons-httpclient:
http://hc.apache.org/httpcomponents-client-ga/index.html
Could you please try whether do you have the same issue by using it?

Best,
Christian

On Wed, Jun 13, 2012 at 4:59 PM, Diyko  wrote:

> I have HTTP4 endpoint which works fine for all addresses except one (throw
> Exhausted after delivery attempt: 1 caught:
> java.lang.IllegalArgumentException: Invalid uri:
> http://weburl.net:8080/handler.jsp)
> For this one endpoint works only URL contains IP not domain name
> Similar behavior for http(throw timeout connection) and jetty components
> (throw null pointer)
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/HTTP4-component-cannot-resolve-DNS-tp5714441.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: One Camel Context with several XMLs

2012-06-14 Thread Vincent Nonnenmacher
a good investment is to buy the 'Camel in Action' book its very well written
and enligthening even for seasoned Camel developers!


On Thu, Jun 14, 2012 at 8:44 PM, Bruno Borges wrote:

> sweet, just what I needed... thanks claus
>
> It seems the docs are a little fuzzy. I spent like 10 min looking around
> but couldn't find this page.
>
> *Bruno Borges*
> (21) 7672-7099
> *www.brunoborges.com*
>
>
>
> On Thu, Jun 14, 2012 at 3:40 PM, Claus Ibsen 
> wrote:
>
> > On Thu, Jun 14, 2012 at 8:22 PM, Bruno Borges  > >wrote:
> >
> > > Is it possible to break a Camel Context accross several XML files?
> > >
> > >
> > See this page about using routeContext
> > http://camel.apache.org/configuring-camel.html
> >
> >
> >
> > > *Bruno Borges*
> > > (21) 7672-7099
> > > *www.brunoborges.com*
> > >
> >
> >
> >
> > --
> > Claus Ibsen
> > -
> > FuseSource
> > Email: cib...@fusesource.com
> > Web: http://fusesource.com
> > Twitter: davsclaus, fusenews
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> >
>


Re: recipient list sending to multiple Camel Processors

2012-06-14 Thread Vincent Nonnenmacher
you can perhaps use this processor in your route to
compute the recipientList yourself, add it
in the header them proceed with the recipient-list pattern



On Thu, Jun 14, 2012 at 9:58 PM, Tyler Durvik  wrote:

> Yes.  I want to dynamically build recipient list, but all the
> destinations will be camel processor.  I see examples where you parse
> a header using a comma (","), or a java.util.List of strings but not
> processors.  I am trying to build the list dynamically inside a bean.
>
>
>
>
> On Thu, Jun 14, 2012 at 3:50 PM, Vincent Nonnenmacher
>  wrote:
> > you means this  is not what
> > you're looking for ?
> >
> >
> > On Thu, Jun 14, 2012 at 9:08 PM, Tyler Durvik 
> wrote:
> >
> >> Is it possible to send a message to a group of Camel processors using
> >> a recipient list ?  I have looked through the documentation and cannot
> >> find an example of this.
> >>
>


Re: recipient list sending to multiple Camel Processors

2012-06-14 Thread Tyler Durvik
Yes.  I want to dynamically build recipient list, but all the
destinations will be camel processor.  I see examples where you parse
a header using a comma (","), or a java.util.List of strings but not
processors.  I am trying to build the list dynamically inside a bean.




On Thu, Jun 14, 2012 at 3:50 PM, Vincent Nonnenmacher
 wrote:
> you means this  is not what
> you're looking for ?
>
>
> On Thu, Jun 14, 2012 at 9:08 PM, Tyler Durvik  wrote:
>
>> Is it possible to send a message to a group of Camel processors using
>> a recipient list ?  I have looked through the documentation and cannot
>> find an example of this.
>>


Re: recipient list sending to multiple Camel Processors

2012-06-14 Thread Vincent Nonnenmacher
you means this  is not what
you're looking for ?


On Thu, Jun 14, 2012 at 9:08 PM, Tyler Durvik  wrote:

> Is it possible to send a message to a group of Camel processors using
> a recipient list ?  I have looked through the documentation and cannot
> find an example of this.
>


Re: How to set header as RFH1 for ibm mq

2012-06-14 Thread Magnus Palmér
(Not really a Camel specific question.)

What version is the WMQ queuemanager?
What version is your WMQ jar-files?

Pretty sure you can get WMQ V7 and JMS to work with RFH, you might need to
use the WMQ native Java API instead.

Are you using WMB V6 or V6.1 brokers still or why do you need a RFH?

Check out this in the IBM Info Center for WMQ -
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.javadoc.doc/WMQJMSClasses/com/ibm/mq/jms/JMSC.html#MQJMS_BROKER_V1
:
*JMS API Compatibility layer. This is provided solely for backwards
compatibility with provider specific JMS applications and should not be
used for new applications. *

MQJMS_BROKER_V1

public static final int *MQJMS_BROKER_V1*

*Deprecated.* This parameter can be passed to
MQConnectionFactory.setBrokerVersion(int)to
indicate that the broker will use RFH1 headers. This is required when
using the WebSphere MQ Publish/Subscribe v6 or WebSphere Business
Integration Message Broker in compatibility mode. If the WebSphere MQ queue
manager being connected to is at version 7, it is necessary to set the
connection factory's PROVIDERVERSION property to "6.0.0.0".

*See 
Also:*MQConnectionFactory.setBrokerVersion(int),
Constant Field 
Values


/M.


2012/6/14 Ashutosh Kumar 

> I am trying to send message from camel route to IBM mq. I need to send it
> as RFH1 header. I tried targetClient=1 but that sends as RFH2 . Also
> setBrokerVersion does not work . Setting brokerVersion is not allowed on
> com.ibm.mq.jms.MQQueueConnectionFactory .
>
> Thanks
>


Re: Why is this not possible with the twitter component in Camel 2.10 ?

2012-06-14 Thread Bruno Borges
It seems I am http://www.youtube.com/watch?v=a01QQZyl-_I

:-D

*Bruno Borges*
(21) 7672-7099
*www.brunoborges.com*



On Thu, Jun 14, 2012 at 3:39 PM, Claus Ibsen  wrote:

> On Thu, Jun 14, 2012 at 8:33 PM, Bruno Borges  >wrote:
>
> > Claus, what is the scheduled date for 2.10 to be released?
> >
> >
> Soon, we want to release it this month.
>
>
> >
> > *Bruno Borges*
> > (21) 7672-7099
> > *www.brunoborges.com*
> >
> >
> >
> > On Thu, Jun 14, 2012 at 3:31 PM, Bruno Borges  > >wrote:
> >
> > > It's not difficult to let the SearchConsumer endpoint work as an
> > > Event-driven too.
> > >
> > > I'm going to work on this on a few weeks, but of course you can code
> your
> > > own if you are in a hurry :-)
> > >
> > > *Bruno Borges*
> > > (21) 7672-7099
> > > *www.brunoborges.com*
> > >
> > >
> > >
> > > On Sat, Jun 2, 2012 at 6:06 PM, Christian Müller <
> > > christian.muel...@gmail.com> wrote:
> > >
> > >> "twitter://search" is only supported in the camel-twitter consumer ->
> > >> from("twitter://search?...")
> > >> Have a look at the source code or the unit tests...
> > >>
> > >> Best,
> > >> Christian
> > >>
> > >> On Fri, Jun 1, 2012 at 7:25 PM, soumya_sd 
> wrote:
> > >>
> > >> > I'm trying to use Camel twitter component.
> > >> > http://camel.apache.org/twitter.html
> > >> >
> > >> > I want to create a route like -
> > >> >
> > >> >from("direct:twitter-search").to(
> > >> >
> > >> >
> > >> >
> > >>
> >
> "twitter://search?type=polling&delay=20&keywords=mykeywords&consumerKey=key&consumerSecret=secret&accessToken=xxx&accessTokenSecret=secret")
> > >> >.to("stream:out");
> > >> >
> > >> >
> > >> >
> > >> >
> > >> > However, looks like this is not supported (see exception below). Can
> > >> > someone
> > >> > explain why?
> > >> >
> > >> >
> > >> > *org.apache.camel.FailedToCreateProducerException: Failed to create
> > >> > Producer
> > >> > for endpoint:
> > >> >
> > >> >
> > >>
> >
> Endpoint[twitter://search?...&delay=20&keywords=mykeyword&type=polling].
> > >> > Reason: java.lang.IllegalArgumentException: Cannot create any
> producer
> > >> with
> > >> > uri
> > >> >
> > >> >
> > >>
> >
> twitter://search?accessToken=.&delay=20&keywords=mykeyword&type=polling.
> > >> > A producer type was not provided (or an incorrect pairing was
> used).*
> > >> >
> > >> > Given that twitter component internally makes use of HTTP REST calls
> > it
> > >> > should be possible to use it both as a consumer as well as a
> producer.
> > >> >
> > >> > For example, I can successfully execute the following route with the
> > >> http
> > >> > component.  I cannot understand why I cannot do the same with the
> > >> twitter
> > >> > component ?
> > >> >
> > >> > from("direct:startgoogleplaces")
> > >> >.process(new
> > HTTPRequestParamProcessor())
> > >> >.setHeader(
> > >> >Exchange.HTTP_QUERY,
> > >> >
> > >> >
> > >> >
> > >>
> >
> simple("location=${in.headers.location}&radius=${in.headers.radius}&types=${in.headers.types}&sensor=${in.headers.sensor}&key=${in.headers.key}"))
> > >> >.to("
> > >> > https://maps.googleapis.com/maps/api/place/search/json";)
> > >> >.unmarshal()
> > >> >.json(JsonLibrary.Jackson,
> > >> > GooglePlaceResponseObject.class)
> > >> >.log("before split the body is
> > >> > ${body}").to("stream:out);
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > View this message in context:
> > >> >
> > >>
> >
> http://camel.465427.n5.nabble.com/Why-is-this-not-possible-with-the-twitter-component-in-Camel-2-10-tp5713823.html
> > >> > Sent from the Camel - Users mailing list archive at Nabble.com.
> > >> >
> > >>
> > >
> > >
> >
>
>
>
> --
> Claus Ibsen
> -
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>


Re: One Camel Context with several XMLs

2012-06-14 Thread Bruno Borges
sweet, just what I needed... thanks claus

It seems the docs are a little fuzzy. I spent like 10 min looking around
but couldn't find this page.

*Bruno Borges*
(21) 7672-7099
*www.brunoborges.com*



On Thu, Jun 14, 2012 at 3:40 PM, Claus Ibsen  wrote:

> On Thu, Jun 14, 2012 at 8:22 PM, Bruno Borges  >wrote:
>
> > Is it possible to break a Camel Context accross several XML files?
> >
> >
> See this page about using routeContext
> http://camel.apache.org/configuring-camel.html
>
>
>
> > *Bruno Borges*
> > (21) 7672-7099
> > *www.brunoborges.com*
> >
>
>
>
> --
> Claus Ibsen
> -
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>


Re: One Camel Context with several XMLs

2012-06-14 Thread Claus Ibsen
On Thu, Jun 14, 2012 at 8:22 PM, Bruno Borges wrote:

> Is it possible to break a Camel Context accross several XML files?
>
>
See this page about using routeContext
http://camel.apache.org/configuring-camel.html



> *Bruno Borges*
> (21) 7672-7099
> *www.brunoborges.com*
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Why is this not possible with the twitter component in Camel 2.10 ?

2012-06-14 Thread Claus Ibsen
On Thu, Jun 14, 2012 at 8:33 PM, Bruno Borges wrote:

> Claus, what is the scheduled date for 2.10 to be released?
>
>
Soon, we want to release it this month.


>
> *Bruno Borges*
> (21) 7672-7099
> *www.brunoborges.com*
>
>
>
> On Thu, Jun 14, 2012 at 3:31 PM, Bruno Borges  >wrote:
>
> > It's not difficult to let the SearchConsumer endpoint work as an
> > Event-driven too.
> >
> > I'm going to work on this on a few weeks, but of course you can code your
> > own if you are in a hurry :-)
> >
> > *Bruno Borges*
> > (21) 7672-7099
> > *www.brunoborges.com*
> >
> >
> >
> > On Sat, Jun 2, 2012 at 6:06 PM, Christian Müller <
> > christian.muel...@gmail.com> wrote:
> >
> >> "twitter://search" is only supported in the camel-twitter consumer ->
> >> from("twitter://search?...")
> >> Have a look at the source code or the unit tests...
> >>
> >> Best,
> >> Christian
> >>
> >> On Fri, Jun 1, 2012 at 7:25 PM, soumya_sd  wrote:
> >>
> >> > I'm trying to use Camel twitter component.
> >> > http://camel.apache.org/twitter.html
> >> >
> >> > I want to create a route like -
> >> >
> >> >from("direct:twitter-search").to(
> >> >
> >> >
> >> >
> >>
> "twitter://search?type=polling&delay=20&keywords=mykeywords&consumerKey=key&consumerSecret=secret&accessToken=xxx&accessTokenSecret=secret")
> >> >.to("stream:out");
> >> >
> >> >
> >> >
> >> >
> >> > However, looks like this is not supported (see exception below). Can
> >> > someone
> >> > explain why?
> >> >
> >> >
> >> > *org.apache.camel.FailedToCreateProducerException: Failed to create
> >> > Producer
> >> > for endpoint:
> >> >
> >> >
> >>
> Endpoint[twitter://search?...&delay=20&keywords=mykeyword&type=polling].
> >> > Reason: java.lang.IllegalArgumentException: Cannot create any producer
> >> with
> >> > uri
> >> >
> >> >
> >>
> twitter://search?accessToken=.&delay=20&keywords=mykeyword&type=polling.
> >> > A producer type was not provided (or an incorrect pairing was used).*
> >> >
> >> > Given that twitter component internally makes use of HTTP REST calls
> it
> >> > should be possible to use it both as a consumer as well as a producer.
> >> >
> >> > For example, I can successfully execute the following route with the
> >> http
> >> > component.  I cannot understand why I cannot do the same with the
> >> twitter
> >> > component ?
> >> >
> >> > from("direct:startgoogleplaces")
> >> >.process(new
> HTTPRequestParamProcessor())
> >> >.setHeader(
> >> >Exchange.HTTP_QUERY,
> >> >
> >> >
> >> >
> >>
> simple("location=${in.headers.location}&radius=${in.headers.radius}&types=${in.headers.types}&sensor=${in.headers.sensor}&key=${in.headers.key}"))
> >> >.to("
> >> > https://maps.googleapis.com/maps/api/place/search/json";)
> >> >.unmarshal()
> >> >.json(JsonLibrary.Jackson,
> >> > GooglePlaceResponseObject.class)
> >> >.log("before split the body is
> >> > ${body}").to("stream:out);
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >> >
> >>
> http://camel.465427.n5.nabble.com/Why-is-this-not-possible-with-the-twitter-component-in-Camel-2-10-tp5713823.html
> >> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >> >
> >>
> >
> >
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Camel Component - Consumer Threading Question

2012-06-14 Thread Claus Ibsen
Hi

Read this FAQ how to stop a running route
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

eg you need to spin off a new thread to do this, as that would be the
cleanest way.


On Thu, Jun 14, 2012 at 6:47 PM, gilboy  wrote:

> Thanks again
>
> 1 final question on this. If an exception occurs in the run method of the
> consumer, I want the endpoint, producer and consumer to be re-started.
>
> I was thinking of handling this as follows:
>
> class CustomConsumer extends DefaultConsumer implements Runnable{
> ..
>
> public void run(){
>
>try{
>
>} catch (Exception exc){
>   getCamelContext().stopRoute("routeName");
>   getCamelContext().startRoute("routeName");
>}
>
> .
> }
>
> However, from the documentation it says I need to call
> getCamelContext().getInflightRepository().remove(Exchange) before calling
> getCamext().stopRoute("routeName"). Unfortunately, in the consumer I do not
> have access to the Exchange object, i.e. I can only create a new Exchange
> object. Any suggestions?
>
> My custom component is a singleton and its referenced in different routes
>
> Thanks
> Joe
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Component-Consumer-Threading-Question-tp5714233p5714489.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: URI attribute

2012-06-14 Thread Claus Ibsen
On Thu, Jun 14, 2012 at 8:33 PM, swwyatt  wrote:

> I have a route similar to the one below. In the from uri, I am thinking
> that
> I should have used a ref attribute instead of a uri attribute. It seems to
> work, but is this ok?
>
> 
>
> 
>  
>  
> 
>
>
Using uri="import" works because you use the  where you
enlist an endpoint with the given id.
But you should prefer to use the ref attribute, or use uri="ref:import", eg
the ref component to refer to an endpoint by a given id.


>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/URI-attribute-tp5714496.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


URI attribute

2012-06-14 Thread swwyatt
I have a route similar to the one below. In the from uri, I am thinking that
I should have used a ref attribute instead of a uri attribute. It seems to
work, but is this ok?




  
  



--
View this message in context: 
http://camel.465427.n5.nabble.com/URI-attribute-tp5714496.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Why is this not possible with the twitter component in Camel 2.10 ?

2012-06-14 Thread Bruno Borges
Claus, what is the scheduled date for 2.10 to be released?


*Bruno Borges*
(21) 7672-7099
*www.brunoborges.com*



On Thu, Jun 14, 2012 at 3:31 PM, Bruno Borges wrote:

> It's not difficult to let the SearchConsumer endpoint work as an
> Event-driven too.
>
> I'm going to work on this on a few weeks, but of course you can code your
> own if you are in a hurry :-)
>
> *Bruno Borges*
> (21) 7672-7099
> *www.brunoborges.com*
>
>
>
> On Sat, Jun 2, 2012 at 6:06 PM, Christian Müller <
> christian.muel...@gmail.com> wrote:
>
>> "twitter://search" is only supported in the camel-twitter consumer ->
>> from("twitter://search?...")
>> Have a look at the source code or the unit tests...
>>
>> Best,
>> Christian
>>
>> On Fri, Jun 1, 2012 at 7:25 PM, soumya_sd  wrote:
>>
>> > I'm trying to use Camel twitter component.
>> > http://camel.apache.org/twitter.html
>> >
>> > I want to create a route like -
>> >
>> >from("direct:twitter-search").to(
>> >
>> >
>> >
>> "twitter://search?type=polling&delay=20&keywords=mykeywords&consumerKey=key&consumerSecret=secret&accessToken=xxx&accessTokenSecret=secret")
>> >.to("stream:out");
>> >
>> >
>> >
>> >
>> > However, looks like this is not supported (see exception below). Can
>> > someone
>> > explain why?
>> >
>> >
>> > *org.apache.camel.FailedToCreateProducerException: Failed to create
>> > Producer
>> > for endpoint:
>> >
>> >
>> Endpoint[twitter://search?...&delay=20&keywords=mykeyword&type=polling].
>> > Reason: java.lang.IllegalArgumentException: Cannot create any producer
>> with
>> > uri
>> >
>> >
>> twitter://search?accessToken=.&delay=20&keywords=mykeyword&type=polling.
>> > A producer type was not provided (or an incorrect pairing was used).*
>> >
>> > Given that twitter component internally makes use of HTTP REST calls it
>> > should be possible to use it both as a consumer as well as a producer.
>> >
>> > For example, I can successfully execute the following route with the
>> http
>> > component.  I cannot understand why I cannot do the same with the
>> twitter
>> > component ?
>> >
>> > from("direct:startgoogleplaces")
>> >.process(new HTTPRequestParamProcessor())
>> >.setHeader(
>> >Exchange.HTTP_QUERY,
>> >
>> >
>> >
>> simple("location=${in.headers.location}&radius=${in.headers.radius}&types=${in.headers.types}&sensor=${in.headers.sensor}&key=${in.headers.key}"))
>> >.to("
>> > https://maps.googleapis.com/maps/api/place/search/json";)
>> >.unmarshal()
>> >.json(JsonLibrary.Jackson,
>> > GooglePlaceResponseObject.class)
>> >.log("before split the body is
>> > ${body}").to("stream:out);
>> >
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> >
>> http://camel.465427.n5.nabble.com/Why-is-this-not-possible-with-the-twitter-component-in-Camel-2-10-tp5713823.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>> >
>>
>
>


Re: Why is this not possible with the twitter component in Camel 2.10 ?

2012-06-14 Thread Bruno Borges
It's not difficult to let the SearchConsumer endpoint work as an
Event-driven too.

I'm going to work on this on a few weeks, but of course you can code your
own if you are in a hurry :-)

*Bruno Borges*
(21) 7672-7099
*www.brunoborges.com*



On Sat, Jun 2, 2012 at 6:06 PM, Christian Müller <
christian.muel...@gmail.com> wrote:

> "twitter://search" is only supported in the camel-twitter consumer ->
> from("twitter://search?...")
> Have a look at the source code or the unit tests...
>
> Best,
> Christian
>
> On Fri, Jun 1, 2012 at 7:25 PM, soumya_sd  wrote:
>
> > I'm trying to use Camel twitter component.
> > http://camel.apache.org/twitter.html
> >
> > I want to create a route like -
> >
> >from("direct:twitter-search").to(
> >
> >
> >
> "twitter://search?type=polling&delay=20&keywords=mykeywords&consumerKey=key&consumerSecret=secret&accessToken=xxx&accessTokenSecret=secret")
> >.to("stream:out");
> >
> >
> >
> >
> > However, looks like this is not supported (see exception below). Can
> > someone
> > explain why?
> >
> >
> > *org.apache.camel.FailedToCreateProducerException: Failed to create
> > Producer
> > for endpoint:
> >
> >
> Endpoint[twitter://search?...&delay=20&keywords=mykeyword&type=polling].
> > Reason: java.lang.IllegalArgumentException: Cannot create any producer
> with
> > uri
> >
> >
> twitter://search?accessToken=.&delay=20&keywords=mykeyword&type=polling.
> > A producer type was not provided (or an incorrect pairing was used).*
> >
> > Given that twitter component internally makes use of HTTP REST calls it
> > should be possible to use it both as a consumer as well as a producer.
> >
> > For example, I can successfully execute the following route with the http
> > component.  I cannot understand why I cannot do the same with the twitter
> > component ?
> >
> > from("direct:startgoogleplaces")
> >.process(new HTTPRequestParamProcessor())
> >.setHeader(
> >Exchange.HTTP_QUERY,
> >
> >
> >
> simple("location=${in.headers.location}&radius=${in.headers.radius}&types=${in.headers.types}&sensor=${in.headers.sensor}&key=${in.headers.key}"))
> >.to("
> > https://maps.googleapis.com/maps/api/place/search/json";)
> >.unmarshal()
> >.json(JsonLibrary.Jackson,
> > GooglePlaceResponseObject.class)
> >.log("before split the body is
> > ${body}").to("stream:out);
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Why-is-this-not-possible-with-the-twitter-component-in-Camel-2-10-tp5713823.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>


Re: dynamic property keys

2012-06-14 Thread paramjyotsingh
Thanks Claus It works ...

--
View this message in context: 
http://camel.465427.n5.nabble.com/dynamic-property-keys-tp5714449p5714488.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Need help in java.net.ConnectException: Connection refused

2012-06-14 Thread Babak Vahdat
Hi

Maybe this could help:

http://camel.apache.org/exception-clause.html#ExceptionClause-Handlingandsendingafixedresponsebacktotheclient

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/Need-help-in-java-net-ConnectException-Connection-refused-tp5714476p5714490.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Component - Consumer Threading Question

2012-06-14 Thread gilboy
Thanks again

1 final question on this. If an exception occurs in the run method of the
consumer, I want the endpoint, producer and consumer to be re-started.

I was thinking of handling this as follows:

class CustomConsumer extends DefaultConsumer implements Runnable{
..

public void run(){

try{

} catch (Exception exc){
   getCamelContext().stopRoute("routeName");  
   getCamelContext().startRoute("routeName");  
}

.
}

However, from the documentation it says I need to call
getCamelContext().getInflightRepository().remove(Exchange) before calling
getCamext().stopRoute("routeName"). Unfortunately, in the consumer I do not
have access to the Exchange object, i.e. I can only create a new Exchange
object. Any suggestions?

My custom component is a singleton and its referenced in different routes

Thanks
Joe

--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Component-Consumer-Threading-Question-tp5714233p5714489.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CXFRS URL Matrix Parameters seemingly stripped away

2012-06-14 Thread Sergey Beryozkin

Hi
On 14/06/12 16:59, desysemia wrote:

This is my first time posting here, so a big hello from me!

Let me start off by stating I'm quite new to Camel and CXF so the issue I'm
seeing might well just be my own doing.

I'm currently running FuseESB/ServiceMix 3.6/4.4.1 including Camel version
2.8.0.

The short version:

is that the PathSegment.getMatrixParameters method returns an empty
collection if the resource is accessed through the URL made available
through the rsServer endpoint, but as expected when accessed through the
rsClient endpoint.  But therefore as I understand it not therefore using the
Camel route at all.

So to me somewhere along the line Camel/CXF is stripping of the matrix
parameters, thoughts?



In CXF alone, HTTPServletRequest.getRequestURI() is used in CXF 
AbstractHTTPDestination to capture the relative path including the 
matrix parameters if any, for the subsequent match to succeed.


I've confirmed locally that matrix parameters are correctly captured 
with the nearly identical test resource method signature.


Perhaps in your case CXF Message.REQUEST_URI property is set by CXF 
Camel differently which may be causing the loss of the parameters


Cheers, Sergey


The long version:

So here goes with the scenario;

I have a Camel route defined using the rsServer and rsClient endpoints, and
I have a resource class implemented and used by both endpoints with a single
JAXRS annotated method as such;

@GET
@Path ( "object/{context}/{version}" )
public String getObject ( @PathParam ( "context" ) PathSegment context,
@PathParam ( "version" ) float version );

This is invoked through the rsServer endpoint URL like so;

http://localhost:9000/test/object/id;key1=value1;key2=value2/1.0

Then calling the getMatrixParameters method on the 'context' parameter
returns an empty collection.

However if this is invoked through the rsClient endpoint URL like so;

http://localhost:9001/test/object/id;key1=value1;key2=value2/1.0

Then calling the getMatrixParameters method on the 'context' parameter
returns a collection containing the two key/value pairs as described.

Hopefully someone out there can point me in the right direction here?

Thanks in advance.

D.


--
View this message in context: 
http://camel.465427.n5.nabble.com/CXFRS-URL-Matrix-Parameters-seemingly-stripped-away-tp5714486.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com


CXFRS URL Matrix Parameters seemingly stripped away

2012-06-14 Thread desysemia
This is my first time posting here, so a big hello from me!

Let me start off by stating I'm quite new to Camel and CXF so the issue I'm
seeing might well just be my own doing.

I'm currently running FuseESB/ServiceMix 3.6/4.4.1 including Camel version
2.8.0.

The short version:

is that the PathSegment.getMatrixParameters method returns an empty
collection if the resource is accessed through the URL made available
through the rsServer endpoint, but as expected when accessed through the
rsClient endpoint.  But therefore as I understand it not therefore using the
Camel route at all.  

So to me somewhere along the line Camel/CXF is stripping of the matrix
parameters, thoughts?

The long version:

So here goes with the scenario;

I have a Camel route defined using the rsServer and rsClient endpoints, and
I have a resource class implemented and used by both endpoints with a single
JAXRS annotated method as such;

@GET
@Path ( "object/{context}/{version}" )
public String getObject ( @PathParam ( "context" ) PathSegment context,
@PathParam ( "version" ) float version );

This is invoked through the rsServer endpoint URL like so;

http://localhost:9000/test/object/id;key1=value1;key2=value2/1.0

Then calling the getMatrixParameters method on the 'context' parameter
returns an empty collection.

However if this is invoked through the rsClient endpoint URL like so;

http://localhost:9001/test/object/id;key1=value1;key2=value2/1.0

Then calling the getMatrixParameters method on the 'context' parameter
returns a collection containing the two key/value pairs as described.

Hopefully someone out there can point me in the right direction here?

Thanks in advance.

D.


--
View this message in context: 
http://camel.465427.n5.nabble.com/CXFRS-URL-Matrix-Parameters-seemingly-stripped-away-tp5714486.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: XPath namespaces in Spring DSL?

2012-06-14 Thread Claus Ibsen
The book has an example and the source code is here
http://code.google.com/p/camelinaction/source/browse/trunk/chapter4/bean/src/main/java/camelinaction/XmlOrderNamespaceService.java

On Thu, Jun 14, 2012 at 3:35 PM, Andreas A.  wrote:

> There is no example of this on the website as far as I can see, but thanks
> for the pointer to the section in the book. I still think there is a
> problem
> when using a . I haven't tried newer versions though.
>
> Also - does Ashwins example produce the same result as this (only in Spring
> DSL)?
>
> https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XPathNamespaceTest.java
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/XPath-namespaces-in-Spring-DSL-tp4556826p5714484.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: XPath namespaces in Spring DSL?

2012-06-14 Thread Andreas A.
There is no example of this on the website as far as I can see, but thanks
for the pointer to the section in the book. I still think there is a problem
when using a . I haven't tried newer versions though.

Also - does Ashwins example produce the same result as this (only in Spring
DSL)?
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XPathNamespaceTest.java



--
View this message in context: 
http://camel.465427.n5.nabble.com/XPath-namespaces-in-Spring-DSL-tp4556826p5714484.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: XPath namespaces in Spring DSL?

2012-06-14 Thread Claus Ibsen
On Thu, Jun 14, 2012 at 1:21 PM, Andreas A.  wrote:

> Claus can you provide an example of the @Xpath-annotation where a namespace
> is specified?
>
>
Camel in Action book, chapter 4, section 4.5.4.

And the Camel docs as well, see
http://camel.apache.org/xpath.html

eg a tip is to just type @xpath in the search box on the Camel front page,
and read the links.




> I have this issue https://issues.apache.org/jira/browse/CAMEL-3155 and I
> believe that Ashwin's and your answer in this thread should solve the
> problem.
>
> I'm using Camel 2.4.0 w. Spring DSL and tried Ashwin's solution however the
> path is not recognized. I think it might be a problem because I'm using a
> CamelContext in one file and importing a RouteContext in another. I've
> tried
> defining the namespace in the beans-tag in each and both at the same time.
>
>
org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath:
> /myns:myroot/myelement/@Attrib. Reason:
> javax.xml.xpath.XPathExpressionException.
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/XPath-namespaces-in-Spring-DSL-tp4556826p5714479.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Need help in java.net.ConnectException: Connection refused

2012-06-14 Thread vargjohn
Hi All,

I have an application which has a camel server running and listening to
activemq server at port number 61616.

When the camel server is running, the activemq server should also be running
at the same time to listen to the messages.

When the activemq is not started i am getting the below exception.

"Could not connect to broker URL: tcp://localhost:61616. Reason:
java.net.ConnectException: Connection refused"

Instead of showing the above exception, i need to show a meaningful message
to the user something like please restart the activemq server, how do i
achieve this, Can anyone give me a solution for this exception.

Thanks & Regards,
John

--
View this message in context: 
http://camel.465427.n5.nabble.com/Need-help-in-java-net-ConnectException-Connection-refused-tp5714476.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: copy of Exchange during Multicast

2012-06-14 Thread Henryk Konsek
> And each of the aggregated messages
> will got another header set on it (HEADER1 and HEADER2 respectively).

I meant KEY1 and KEY2 :) .

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com


Re: copy of Exchange during Multicast

2012-06-14 Thread Henryk Konsek
Hi,

> Is there a way to make changes done to the
> header visible in further processing?

Yes. Actually modifications to the headers of the exchanged copied by
multicast are available in the aggregator.

In the example below GroupedExchangeAggregationStrategy will aggregate
two exchanges copied by multicast. And each of the aggregated messages
will got another header set on it (HEADER1 and HEADER2 respectively).


CamelContext camelContext = new DefaultCamelContext();
camelContext.addRoutes(new RouteBuilder() {
  @Override
  public void configure() throws Exception {
from("direct:start").multicast(new GroupedExchangeAggregationStrategy()).
  to("direct:headerModifier1", "direct:headerModifier2").
end().
to("log:AGGREGATED");

from("direct:headerModifier1").process(new Processor() {
  @Override
  public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader("KEY1", "VALUE1");
  }
});

from("direct:headerModifier2").process(new Processor() {
  @Override
  public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader("KEY2", "VALUE2");
  }
});
  }
});

camelContext.start();
camelContext.createProducerTemplate().sendBody("direct:start", "TestMe!");



Kind regards.

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com


Re: XPath namespaces in Spring DSL?

2012-06-14 Thread Andreas A.
Claus can you provide an example of the @Xpath-annotation where a namespace
is specified?

I have this issue https://issues.apache.org/jira/browse/CAMEL-3155 and I
believe that Ashwin's and your answer in this thread should solve the
problem.

I'm using Camel 2.4.0 w. Spring DSL and tried Ashwin's solution however the
path is not recognized. I think it might be a problem because I'm using a
CamelContext in one file and importing a RouteContext in another. I've tried
defining the namespace in the beans-tag in each and both at the same time.

org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath:
/myns:myroot/myelement/@Attrib. Reason:
javax.xml.xpath.XPathExpressionException.

--
View this message in context: 
http://camel.465427.n5.nabble.com/XPath-namespaces-in-Spring-DSL-tp4556826p5714479.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Can I use CAMEL with MuleESB?

2012-06-14 Thread Henryk Konsek
> But I don't find how to use together CAMEL in MuleESB.

Camel is a routing engine used by ServiceMix ESB [1]. If you want to
use Camel efficiently, you probably want to deploy it on ServiceMix,
not on other ESB. I suggest you to decide whether you want to use
ServiceMix+Camel or MuleESB.

Mixing Camel and Mule (although possible) smells like poor
architecture choice :) .

[1] http://servicemix.apache.org

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com


copy of Exchange during Multicast

2012-06-14 Thread kenhans
according to  http://camel.apache.org/multicast.html
http://camel.apache.org/multicast.html , multicast will copy the source
Exchange and multicast each copy. I.e. changes done to the Exchange remains
local to the multicast recipient. Is there a way to make changes done to the
header visible in further processing? Particularly, I would like to see if
the Exchange.FILTER_MATCHED header has been set or not. With the
MulticastDefinition below, the header is lost before reaching aggregation.

Any thoughts are highly appreciated.

MulticastDefinition multicastDefinition = route.multicast(); 
for (Producer producer : producers) { 
  multicastDefinition 
  .filter().method(producer, "filter")   
  .bean(producer, "createEvent") 
  .to(EndPointUri.INCOMING_EVENT_QUEUE); 
} 
multicastDefinition.aggregate(constant(true) , new
MyAggregationStrategy()).completionTimeout(3000).to("log:dummy");

--
View this message in context: 
http://camel.465427.n5.nabble.com/copy-of-Exchange-during-Multicast-tp5714477.html
Sent from the Camel - Users mailing list archive at Nabble.com.