Re: New to Camel, adding smtp completion notification using XML DSL

2014-11-14 Thread Pontus Ullgren
Hi,

Simply set the body to the content you want in the email.
Something like this (pseudo code that is not tested) should do it

setBody
simpleFile ${in.header.CamelFileName} has been processed/simple
/setBody

// Pontus

On Thu, Nov 13, 2014 at 4:29 PM, fidoedidoe gavin.fow...@sagepub.co.uk wrote:
 Hi I'm new to camel (so forgive me for asking dumb question). Having worked a
 few examples and successfully created some test routes - I'd like to email
 recipient(s) on completion. Ultimately the intent would  be to email success
 / failure...but taking baby steps, just an email at the end of processing
 would be enough for me to expand my understanding.

 In my real code (not the pseudo below) I've successfully received an email
 *but* I cannot understand how to override the email body (currently it's the
 content of the message processed by direct:start - in my instance a zip
 file).

 I've experimented with transform (to transform the message/body before
 emailing) but that didn't appear to work.

 Any suggestions?!

 Kind regards





 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/New-to-Camel-adding-smtp-completion-notification-using-XML-DSL-tp5759060.html
 Sent from the Camel - Users mailing list archive at Nabble.com.


Camel-swagger does not support query parameters?

2014-11-14 Thread Liliana.Neagul
Hi, 

I'm trying to use Rest DSL for generating documentation for swagger. 

Do you know how to add a description for every parameter from URI, or how
can I use query parameters? 

like: http://host/resource?*limit*=100 (where limit, is considered query
parameter). 

I found a Jira issue that query parameters are not supported yet:
https://issues.apache.org/jira/browse/CAMEL-7936  ? 

Until now looks like only *path *and *body *parameter types are supported? 

Any information about query parameter in next camel release? 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-swagger-does-not-support-query-parameters-tp5759101.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem with REST DSL (2.14.0) and String bean

2014-11-14 Thread Vaïsse-Lesteven Arthur
Thanks to a teammate, I finally understood the error.

Problem really come from the definition of a java.lang.String bean in the
camel context.
When putting bean id=source class=java.lang.Stringconstructor-arg
type=java.lang.String value=file:/opt/a/directory/data/audio //bean
in the camel context I got the following log :

[  main] JaxbDataFormat INFO 
Creating JAXBContext with contextPath: file:/opt/a/directory/data/audio and
ApplicationContextClassLoader: sun.misc.Launcher$AppClassLoader@3485def8

My understanding of the situation is that if any java.lang.String object
is defined it is then used by the JAXBContext. They probably seek for an
autowired String parameter that is normally always null. 
Replacing source bean by a bean with a string attribute solve the problem.

Unexpected side effect discovered !

Thank for your attention and your time.

Arthur.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-REST-DSL-2-14-0-and-String-bean-tp5758812p5759102.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: XmlSecurity Endpoint: Adding KeyValue as KeyInfo child in signature

2014-11-14 Thread Franz Paul Forsthofer
Hello Gonzalo Vàsquez,

KeyValue:  PublicKey key = cert.getPublicKey();
 KeyValue keyInfoFactory.newKeyValue(key);

ListObject keyInfoContent = new ArrayListObject(1));
if (keyValue != null) {
keyInfoContent.add(keyValue);
}
KeyInfo keyInfo = keyInfoFactory.newKeyInfo(keyInfoContent,
keyInfoId)

Additional References: see
http://camel.apache.org/xml-security-component.html and there in the
chapter Signing Option you find the option 'properties': For adding
additional References and Objects to the XML signature which contain
additional properties, you can provide a bean which implements the
XmlSignatureProperties
https://github.com/apache/camel/blob/master/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XmlSignatureProperties.java
 interface.

Line breaks: Here I have no solution. The component uses Apache Santuario
or the JSR105 implementation of the JRE. Mybe you can find more information
in the Santuario spec.

Regards Franz

On Wed, Nov 12, 2014 at 9:29 PM, Gonzalo Vasquez gvasq...@altiuz.cl wrote:

 Dear list members,

 Can you please provide me hints on how to improve my current keyAccesor
 to achieve adding the KeyValue node in the KeyInfo element?

 Regarding the base64 encoded parts, how can I force the linebreaks to
 avoid never-ending lines?

 I'm also missing a Reference element in the SignedInfo, and don't know
 how to add it.

 Any additional comments would also be appreciated.

 Please see attached files:

 1.- signed.xml: current output format
 2.- signed2.xml: desired format
 3.- spring-ws-servlet.xml: current spring/camel config
 4.- Java Files: KeyAccesor / Selector
   Gonzalo Vásquez Sáez
 Gerente Investigación y Desarrollo (RD)
 Altiuz Soluciones Tecnológicas de Negocios Ltda.
 Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
 +56 2 335 2461
   gvasq...@altiuz.cl
 http://www.altiuz.cl
 http://www.altiuzreports.com
   https://www.facebook.com/altiuz  http://twitter.com/altiuz
 http://www.linkedin.com/company/altiuz








Re: Error while deploying camel proxy in tomcat

2014-11-14 Thread Royamit
Thnaks for the help Willem  Is there any way to close the spring
application before redeploying the camel proxy service? And how can i do the
aforesaid.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Error-while-deploying-camel-proxy-in-tomcat-tp5758987p5759103.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Support for CXF dispatch api in the latest release of camel

2014-11-14 Thread Aki Yoshida
I am not still sure what you mean by using the dispatch API in camel.

Willem already answered to your question and I am adding a few info.

The actual dispatching part (i.e., sending out a generic message) is
there in Camel. The message constructing part isn't there because in
camel, you typically construct a message elsewhere as a payload or a
SOAP-envelope and simply forwarding it to a cxf endpoint that can send
that message.

If that is what you can use, you can find the examples in these tests
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob;f=components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfDispatchPayloadTest.java
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob;f=components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfDispatchMessageTest.java

regards, aki

2014-11-12 5:54 GMT+01:00 santosh das santoshdas1...@gmail.com:
 Thanks a lot for the suggestion, do we have any samples specific to cxf
 that i can try out?
 I need some more clarification between the relationship of the beans and
 processors and how they fit in together?

 I believe we can have an anonymous innerclass of processor to define the
 custom business logic, are you proposing to hook in CXF dispatch code in
 there?

 Also is there a plan to support CXF dispatch API out of the box from camel
 in the near future.

 I find it really encouraging to get suggestions from an active community
 group.
 Appreciate for all the help provided so far and going forward.

 Thanks,
 Santosh


 On Wed, Nov 12, 2014 at 8:10 AM, Willem Jiang willem.ji...@gmail.com
 wrote:

 Current camel-cxf doesn’t support the dispatch API, you can use the
 PAYLOAD message data format to do the something.

 BTW, if you still want to use the CXF dispatch API, you can use bean[1] or
 processor[2] to integration the invocation within Camel route.

 [1]http://camel.apache.org/bean.html
 [2]http://camel.apache.org/processor.html

 --
 Willem Jiang

 Red Hat, Inc.
 Web: http://www.redhat.com
 Blog: http://willemjiang.blogspot.com (English)
 http://jnn.iteye.com (Chinese)
 Twitter: willemjiang
 Weibo: 姜宁willem



 On November 11, 2014 at 5:41:52 PM, santoshdas1984 (
 santoshdas1...@gmail.com) wrote:
  Hi ,
 
  Could you please elaborate a bit more about the Camel CXF endpoint.
  We dont want to use the spring based configuration as we are evaluating
 this
  for our product
 
  The same reason we have used CXF For e.g.
  For Ws-Addressing we are using the dispatch api as follows
 
  import static
 
 org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES;
 
  import java.io.FileNotFoundException;
  import java.io.IOException;
 
  import javax.xml.namespace.QName;
  import javax.xml.soap.MessageFactory;
  import javax.xml.soap.SOAPBody;
  import javax.xml.soap.SOAPConstants;
  import javax.xml.soap.SOAPElement;
  import javax.xml.soap.SOAPEnvelope;
  import javax.xml.soap.SOAPException;
  import javax.xml.soap.SOAPMessage;
  import javax.xml.soap.SOAPPart;
  import javax.xml.ws.Dispatch;
  import javax.xml.ws.Service;
  import javax.xml.ws.soap.SOAPBinding;
 
  import org.apache.cxf.endpoint.Client;
  import org.apache.cxf.jaxws.DispatchImpl;
  import org.apache.cxf.ws.addressing.AddressingProperties;
  import org.apache.cxf.ws.addressing.AttributedURIType;
  import org.apache.cxf.ws.addressing.ObjectFactory;
  import org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl;
  import org.apache.cxf.ws.addressing.soap.MAPCodec;
 
  import com.pega.pegarules.priv.ModuleVersion;
 
  public class TestCXFAddressing {
 
  public static final String VERSION = ModuleVersion.register($Id$);
  private static final ObjectFactory WSA_OBJECT_FACTORY = new
  ObjectFactory();
 
  /**
  * @param args
  * @throws SOAPException
  * @throws IOException
  */
  public static void main(String[] args) throws IOException, SOAPException
 {
  testService();
  }
 
  private static void testService() throws FileNotFoundException,
  IOException, SOAPException {
  QName serviceName = new QName(, );
  Service s = Service.create(serviceName);
 
  QName portName = new QName(, );
 
  s.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
  http://localhost:9000/SoapContext/SoapPort;);
 
  Dispatch dispatch = s.createDispatch(portName,
  SOAPMessage.class, Service.Mode.MESSAGE);
  Client client = ((DispatchImpl) dispatch).getClient();
 
  // engage addressing interceptors
  MAPCodec mapCodec = new MAPCodec();
  MAPAggregatorImpl mapAggregator = new MAPAggregatorImpl();
 
  client.getOutInterceptors().add(mapCodec);
  client.getOutInterceptors().add(mapAggregator);
  client.getInInterceptors().add(mapCodec);
  client.getInInterceptors().add(mapAggregator);
 
  // set addressing property in request context
  dispatch.getRequestContext().put(CLIENT_ADDRESSING_PROPERTIES,
  createMaps());
 
  // Create a message. This example works with the SOAPPART.
  MessageFactory mf = MessageFactory
  .newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
  SOAPMessage 

Re: New to Camel, adding smtp completion notification using XML DSL

2014-11-14 Thread fidoedidoe
Many thanks for the reply Pontus! Your advice has got me over the hurdle -
most appreciated. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/New-to-Camel-adding-smtp-completion-notification-using-XML-DSL-tp5759060p5759113.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How to remove Sequential processing failed for number ... from soap fault.

2014-11-14 Thread Frankiboy
   
  I want to give this back in my soap fault:
  Endpoint don't exist in property files Unique log number:
1c291263-a2a1-4505-bcc3-efbc260b29a5
 
  I get this:
  Sequential processing failed for number 1. Exchange[Message: [Body is 
 
null]]. Caused by:   [org.apache.cxf.binding.soap.SoapFault - Endpoint
don't exist in property files Unique log number:
1c291263-a2a1-4505-bcc3-efbc260b29a5

  seems like camels framework gives me:
  Sequential processing failed for number 1. Exchange[Message: [Body is 
 
null]]. Caused by: [org.apache.cxf.binding.soap.SoapFault -

   I dont want this camel message, how to remove it ? 


   Here is my code:

   exchange.removeProperty(Exchange.EXCEPTION_CAUGHT);
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 500);
exchange.getOut().setFault(true);
SoapFault sf = new SoapFault(message,SoapFault.FAULT_CODE_SERVER);
throw sf;

   Frank




--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-remove-Sequential-processing-failed-for-number-from-soap-fault-tp5759111.html
Sent from the Camel - Users mailing list archive at Nabble.com.


log exceptions in DeadLetterChannel error handler

2014-11-14 Thread Marco Westermann

Hi all,

if I have a route like this:

from(timer..)
.bean(MyBean.class, test)


If I deploy that to servicemix and there is an exception in the MyBean 
class, I get an exception stack trace in servicemix.log. But if I add a 
global error handler like this:


errorHandler(deadLetterChannel(activemq:failedMessages).maximumRedeliveries(2))

from(timer..)
.bean(MyBean.class, test)

exceptions are not logged to servicemix.log anymore. I use Servicemix 
4.5.2 (Camel 2.10.6). Is there a way to use global deadLetterChannel 
error handler and also log exceptions to servicemix.log? I already tried 
to configure the deadLetterChannel by calling logStackTrace(true) but 
that makes no difference.


regards, Marco


CXF - Error starting route with CXF endpoint

2014-11-14 Thread contactreji
Hey 

I get following exception while starting my route with CXF. I guess my
project was executing fine till 2 days back. But today I have this issue.

*Error occurred while running main from: org.apache.camel.spring.Main
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:440)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.camel.RuntimeCamelException:
java.lang.RuntimeException: Soap 1.1 endpoint already registered on address
http://D-113063918:9191/mes/bw/MEStoBW_Material
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1280)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:280)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)*

I am posting my camel route file for your reference

*?xml version=1.0 encoding=UTF-8?



beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:camel=http://camel.apache.org/schema/spring;
xmlns:jaxws=http://cxf.apache.org/jaxws;
xmlns:osgi=http://www.springframework.org/schema/osgi;
xmlns:cxf=http://camel.apache.org/schema/cxf;
xmlns:http-conf=http://cxf.apache.org/transports/http/configuration;
xmlns:http=http://cxf.apache.org/transports/http/configuration;
xmlns:sec=http://cxf.apache.org/configuration/security;
xmlns:ctx=http://www.springframework.org/schema/context;
xsi:schemaLocation=
http://camel.apache.org/schema/cxf 
 http://camel.apache.org/schema/cxf/camel-cxf.xsd
 http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/jaxws 
http://cxf.apache.org/schemas/jaxws.xsd 
 http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
 http://camel.apache.org/schema/spring 
 http://camel.apache.org/schema/spring/camel-spring.xsd
 http://www.springframework.org/schema/osgi
  http://www.springframework.org/schema/osgi/spring-osgi.xsd
  http://cxf.apache.org/configuration/security
http://cxf.apache.org/schemas/configuration/security.xsd
  http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
  http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd 
   
  

ctx:property-placeholder

location=file:D:/FactoryESB-PropertyFiles/ID_Name.properties,file:D:/FactoryESB-PropertyFiles/utility.properties
/



cxf:cxfEndpoint id=ISSUEINVENTORY_CXF address=${fuseEndpoint}

serviceClass=outotec.pi.mes.id52.materialconsumptions.SIID52MaterialConsumptionAsyncOut
wsdlURL=wsdl/SI_ID52_MaterialConsumption_async_outService.wsdl
serviceName=ons:SI_ID52_MaterialConsumption_async_outService
endpointName=ons:HTTP_Port
xmlns:ons=urn:outotec:pi:mes:id52:MaterialConsumptions
xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/;
/cxf:cxfEndpoint



bean id=jmsConnectionFactory
class=org.apache.activemq.ActiveMQConnectionFactory
property name=brokerURL value=${brokerURL} /
property name=userName value=${brokerUserName} /
property name=password value=${brokerPassword} /
/bean
bean id=pooledConnectionFactory
class=org.apache.activemq.pool.PooledConnectionFactory
init-method=start destroy-method=stop
property name=maxConnections value=8 /
property name=connectionFactory ref=jmsConnectionFactory /
property name=idleTimeout value=0 /
/bean
bean id=jmsConfig
class=org.apache.camel.component.jms.JmsConfiguration
property name=connectionFactory 
ref=pooledConnectionFactory /
property name=concurrentConsumers value=10 /
/bean

bean id=AMQbrokerConnector
class=org.apache.activemq.camel.component.ActiveMQComponent
property name=configuration ref=jmsConfig /
/bean

camelContext xmlns=http://camel.apache.org/schema/spring;

MongoDB: Persistent tail tracking with concurrent tailable consumers

2014-11-14 Thread jpeschke
Hello,
I observe a very strange behaviour with concurrent tailable consumers and
persistent tail tracking. Perhaps you have an idea:

Scenario:
- A MongoDB Replicaset of 3 servers, running MongoDB 2.4.11
- 2 camel servers (tomcat7 with Sun JDK, Camel 2.13.1)
- On each server, 5 tailable cursor consumer endpoints, listening on 5
different collections with persistent tail tracking enabled
- The persistent id for each consumer endpoint is defined as:
  hostname_CollectionName
- So the collection storing the persistent tail tracking information
(consumedUpdates) looks something like this:



The endpoint configuration looks something like this:

mongodb://mongoDBInstance?collection=COLLECTIONdatabase=...persistentId=HOST_COLLECTIONpersistentTailTracking=truetailTrackCollection=consumedUpdatestailTrackIncreasingField=updateId

The problem: Only one document in the consumedUpdates collection seems to
be updated, no matter which collection or host is affected. It seems like
this is always the first document in the collection. So all consumers write
into the same document, overwriting information coming from other consumers
:(

The problem does not occur on our test environment (1 camel server, 1
MongoDB, both on the same machine).

Any ideas?

Thanks for your help!

Best regards,
Joerg





--
View this message in context: 
http://camel.465427.n5.nabble.com/MongoDB-Persistent-tail-tracking-with-concurrent-tailable-consumers-tp5759131.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RoutingSlip ControlBus creates new Threads

2014-11-14 Thread Robin.Lutter
Hello,

in our application we stop routes after execution and start them again with 
controlbus. During runtime, the thread count increases continuously with each 
invocation.
We have some consumer routes (ftp, jcifs, file) which should be event based 
activated and deactivated after batch consuming. Stop is the last step (to

Startprocess invoked from message driven bean in jboss: 
template = context.getProducerTemplate();
template.sendBody(direct:start, myRoute);

Startroute: 
from(direct:start)
   .setHeader(HEADER_CONTROL_ROUTE, controlbus:route?routeId= + getRouteId() 
+ action=startasync=true)
   .routingSlip().header(HEADER_CONTROL_ROUTE)
   .end();

Stoproute:
from(direct:stop)
   .setHeader(HEADER_CONTROL_ROUTE, controlbus:route?routeId= + getRouteId() 
+ action=stopasync=true)   
   .routingSlip().header(HEADER_CONTROL_ROUTE)
   .end()

Exampleroute: 
From(file://D:data?consumer.bridgeErrorHandler=truedelay=2147483647eagerMaxMessagesPerPoll=falseidempotent=falsemaxMessagesPerPoll=500noop=truesendEmptyMessageWhenIdle=truesortBy=file%3AmodifieduseFixedDelay=false
 )
  .routeId(getRouteId())
  .autoStartup(false)
  .streamCaching().log(LoggingLevel.TRACE, BODY: ${body})
  .shutdownRunningTask(ShutdownRunningTask.CompleteAllTasks)
   .threads(1)
   .process(myEJB).
  .aggregate(property(PROPERTY), new MyAggregationStrategy())
  .completionFromBatchConsumer()
  .oncompletion().to(direct:stop);

After each invocation and of startprocess some new threads are created and in 
WAIT state:
Camel (camel-1) thread #11 - ControlBus 
Camel (camel-1) thread #12 - file://D:/data
Camel (camel-1) thread #13 - OnCompletion
Camel (camel-1) thread #14 - ControlBus

My assumption is, that threads are reused or stopped after stopping the route.
Any ideas what is going wrong? We are using camel-2.11.2 and verified this 
behavior with 2.12.0

Thanks for any advice
Robin


Re: Using custom MDC values with Camel

2014-11-14 Thread James Murphy
Joni Nousiainen joni.nousiainen@... writes:

 
 Thank you for your answer! I'll look into creating a custom UoW
 factory. Also, I will follow the JIRA issue (CAMEL-7444) for future
 updates.
 
 BR,
 Joni
 
 
 

Hi Joni,

How did you get on with this?

I'm looking into something very similar myself. I want to output to MDC a
custom header from the exchange and expose it when logging any exceptions
rather than logging the body/breadcrumbId of the exchange etc.

I'll look at implementing a custom UoW Factory for MDC and adding the
exchange headers that way.

Regards
James





Re: Problem with REST DSL (2.14.0) and String bean

2014-11-14 Thread Taariq Levack
Thought it would be weird to be jaxb versions in camel components.

Glad you found it, thanks for sharing your fix as well.

On Fri, Nov 14, 2014 at 11:36 AM, Vaïsse-Lesteven Arthur 
arthurvai...@yahoo.fr wrote:

 Thanks to a teammate, I finally understood the error.

 Problem really come from the definition of a java.lang.String bean in the
 camel context.
 When putting bean id=source class=java.lang.Stringconstructor-arg
 type=java.lang.String value=file:/opt/a/directory/data/audio //bean
 in the camel context I got the following log :

 [  main] JaxbDataFormat INFO
 Creating JAXBContext with contextPath: file:/opt/a/directory/data/audio and
 ApplicationContextClassLoader: sun.misc.Launcher$AppClassLoader@3485def8

 My understanding of the situation is that if any java.lang.String object
 is defined it is then used by the JAXBContext. They probably seek for an
 autowired String parameter that is normally always null.
 Replacing source bean by a bean with a string attribute solve the
 problem.

 Unexpected side effect discovered !

 Thank for your attention and your time.

 Arthur.



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Problem-with-REST-DSL-2-14-0-and-String-bean-tp5758812p5759102.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: camel xmljson add @ signs to the json output. how to remove the @ signs

2014-11-14 Thread salemi
where can I find the source code for this?



-
Alireza Salemi
--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-xmljson-add-signs-to-the-json-output-how-to-remove-the-signs-tp5759013p5759147.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: log exceptions in DeadLetterChannel error handler

2014-11-14 Thread Claus Ibsen
There is plenty of options on deadLetterChannel to configure logging
exhausted and whatnot. Try to thinker with those.

On Fri, Nov 14, 2014 at 1:11 PM, Marco Westermann marwesterm...@gmx.de wrote:
 Hi all,

 if I have a route like this:

 from(timer..)
 .bean(MyBean.class, test)


 If I deploy that to servicemix and there is an exception in the MyBean
 class, I get an exception stack trace in servicemix.log. But if I add a
 global error handler like this:

 errorHandler(deadLetterChannel(activemq:failedMessages).maximumRedeliveries(2))

 from(timer..)
 .bean(MyBean.class, test)

 exceptions are not logged to servicemix.log anymore. I use Servicemix 4.5.2
 (Camel 2.10.6). Is there a way to use global deadLetterChannel error handler
 and also log exceptions to servicemix.log? I already tried to configure the
 deadLetterChannel by calling logStackTrace(true) but that makes no
 difference.

 regards, Marco



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: camel xmljson add @ signs to the json output. how to remove the @ signs

2014-11-14 Thread Claus Ibsen
Hi

See
http://camel.apache.org/source.html

Though if you are familiar with github you can also find it there.
Which IMHO is much easier

https://github.com/apache/camel

And the component is here
https://github.com/apache/camel/tree/master/components/camel-xmljson

On Fri, Nov 14, 2014 at 6:12 PM, salemi sal...@avaya.com wrote:
 where can I find the source code for this?



 -
 Alireza Salemi
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/camel-xmljson-add-signs-to-the-json-output-how-to-remove-the-signs-tp5759013p5759147.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Route policy for clustered servicemix/camel based on hazelcast locks

2014-11-14 Thread bishap
Hello everyone,

I’m new to camel and I’m trying to develop a route policy that insures a
single instance execution of a route in a clustered servicemix /camel. The
policy will be used for endpoints that don’t manage concurrent access such
as IMAP.

For the policy I opted for a lock mechanism based on Hazelcast, but I’m not
sure when (in the route lifecycle) shall the lock occur and what part of the
route is the most suitable to stop (rout, endpoint, consumer). I tested
stopping the route and the consumer.

To sum up what i understood and my tests :

onInit() - the route and the consumer aren’t started yet so the lock and
stop aren’t useful here. I also tried an autoStart=false, so that I can
start the route in the onInit() but that didn’t work.

onStart()- the route/consumer are already started so maybe stopping them
here is not the most appropriate manner.

Do you have any advice on when shall the lock occur and on which part of the
route is the most appropriate to stop?

Thank you in advance,

-Bashar




--
View this message in context: 
http://camel.465427.n5.nabble.com/Route-policy-for-clustered-servicemix-camel-based-on-hazelcast-locks-tp5759149.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: XmlSecurity Endpoint: Adding KeyValue as KeyInfo child in signature

2014-11-14 Thread Colm O hEigeartaigh
 Line breaks: Here I have no solution. The component uses Apache Santuario
 or the JSR105 implementation of the JRE. Mybe you can find more
information
 in the Santuario spec.

Line breaks are controlled by the System property
org.apache.xml.security.ignoreLineBreaks. So if you want to add line
breaks, simply define system property
org.apache.xml.security.ignoreLineBreaks=false.

Colm.

On Fri, Nov 14, 2014 at 9:58 AM, Franz Paul Forsthofer 
emc2...@googlemail.com wrote:

 Hello Gonzalo Vàsquez,

 KeyValue:  PublicKey key = cert.getPublicKey();
  KeyValue keyInfoFactory.newKeyValue(key);

 ListObject keyInfoContent = new ArrayListObject(1));
 if (keyValue != null) {
 keyInfoContent.add(keyValue);
 }
 KeyInfo keyInfo = keyInfoFactory.newKeyInfo(keyInfoContent,
 keyInfoId)

 Additional References: see
 http://camel.apache.org/xml-security-component.html and there in the
 chapter Signing Option you find the option 'properties': For adding
 additional References and Objects to the XML signature which contain
 additional properties, you can provide a bean which implements the
 XmlSignatureProperties
 
 https://github.com/apache/camel/blob/master/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XmlSignatureProperties.java
 
  interface.

 Line breaks: Here I have no solution. The component uses Apache Santuario
 or the JSR105 implementation of the JRE. Mybe you can find more information
 in the Santuario spec.

 Regards Franz

 On Wed, Nov 12, 2014 at 9:29 PM, Gonzalo Vasquez gvasq...@altiuz.cl
 wrote:

  Dear list members,
 
  Can you please provide me hints on how to improve my current keyAccesor
  to achieve adding the KeyValue node in the KeyInfo element?
 
  Regarding the base64 encoded parts, how can I force the linebreaks to
  avoid never-ending lines?
 
  I'm also missing a Reference element in the SignedInfo, and don't know
  how to add it.
 
  Any additional comments would also be appreciated.
 
  Please see attached files:
 
  1.- signed.xml: current output format
  2.- signed2.xml: desired format
  3.- spring-ws-servlet.xml: current spring/camel config
  4.- Java Files: KeyAccesor / Selector
Gonzalo Vásquez Sáez
  Gerente Investigación y Desarrollo (RD)
  Altiuz Soluciones Tecnológicas de Negocios Ltda.
  Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
  +56 2 335 2461
gvasq...@altiuz.cl
  http://www.altiuz.cl
  http://www.altiuzreports.com
https://www.facebook.com/altiuz  http://twitter.com/altiuz
  http://www.linkedin.com/company/altiuz
 
 
 
 
 
 




-- 
Colm O hEigeartaigh

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


Re: XmlSecurity Endpoint: Adding KeyValue as KeyInfo child in signature

2014-11-14 Thread Gonzalo Vasquez
nice to know, thanks!

Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (RD)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461
gvasq...@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


El 14-11-2014, a las 14:28, Colm O hEigeartaigh cohei...@apache.org escribió:

 Line breaks: Here I have no solution. The component uses Apache Santuario
 or the JSR105 implementation of the JRE. Mybe you can find more
 information
 in the Santuario spec.
 
 Line breaks are controlled by the System property
 org.apache.xml.security.ignoreLineBreaks. So if you want to add line
 breaks, simply define system property
 org.apache.xml.security.ignoreLineBreaks=false.
 
 Colm.
 
 On Fri, Nov 14, 2014 at 9:58 AM, Franz Paul Forsthofer 
 emc2...@googlemail.com wrote:
 
 Hello Gonzalo Vàsquez,
 
 KeyValue:  PublicKey key = cert.getPublicKey();
 KeyValue keyInfoFactory.newKeyValue(key);
 
ListObject keyInfoContent = new ArrayListObject(1));
if (keyValue != null) {
keyInfoContent.add(keyValue);
}
KeyInfo keyInfo = keyInfoFactory.newKeyInfo(keyInfoContent,
 keyInfoId)
 
 Additional References: see
 http://camel.apache.org/xml-security-component.html and there in the
 chapter Signing Option you find the option 'properties': For adding
 additional References and Objects to the XML signature which contain
 additional properties, you can provide a bean which implements the
 XmlSignatureProperties
 
 https://github.com/apache/camel/blob/master/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XmlSignatureProperties.java
 
 interface.
 
 Line breaks: Here I have no solution. The component uses Apache Santuario
 or the JSR105 implementation of the JRE. Mybe you can find more information
 in the Santuario spec.
 
 Regards Franz
 
 On Wed, Nov 12, 2014 at 9:29 PM, Gonzalo Vasquez gvasq...@altiuz.cl
 wrote:
 
 Dear list members,
 
 Can you please provide me hints on how to improve my current keyAccesor
 to achieve adding the KeyValue node in the KeyInfo element?
 
 Regarding the base64 encoded parts, how can I force the linebreaks to
 avoid never-ending lines?
 
 I'm also missing a Reference element in the SignedInfo, and don't know
 how to add it.
 
 Any additional comments would also be appreciated.
 
 Please see attached files:
 
 1.- signed.xml: current output format
 2.- signed2.xml: desired format
 3.- spring-ws-servlet.xml: current spring/camel config
 4.- Java Files: KeyAccesor / Selector
  Gonzalo Vásquez Sáez
 Gerente Investigación y Desarrollo (RD)
 Altiuz Soluciones Tecnológicas de Negocios Ltda.
 Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
 +56 2 335 2461
  gvasq...@altiuz.cl
 http://www.altiuz.cl
 http://www.altiuzreports.com
  https://www.facebook.com/altiuz  http://twitter.com/altiuz
 http://www.linkedin.com/company/altiuz
 
 
 
 
 
 
 
 
 
 
 -- 
 Colm O hEigeartaigh
 
 Talend Community Coder
 http://coders.talend.com



Re: CXF webservice deployment on glassfish

2014-11-14 Thread sab12in
Hi,

I have both cxf-rt-transports-http,cxf-rt-transports-http-jetty jar and now
i get the following exception.



Exception while deploying the app [camel-example-reportincident-2.14.0] :
The lifecycle method [finalizeConfig] must not throw a checked exception.
Related annotation information: annotation
[@javax.annotation.PostConstruct()] on annotated element [public void
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.finalizeConfig()
throws java.security.GeneralSecurityException,java.io.IOException] of type
[METHOD]. Please see server.log for more details.
Thanks and Regards,
Sabyasachi



--
View this message in context: 
http://camel.465427.n5.nabble.com/CXF-webservice-deployment-on-glassfish-tp5758405p5759153.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Wiretap adds exchanges to MockEndpoint used in NotifyBuilder expression.

2014-11-14 Thread wjmcdonald
OK.  I guess I was thinking about it such that a wiretap is like a tee where
the new exchange isn't part of the current route, so I didn't expect it to
end up in the mock for the route.  I worked around it by using a filter. 
Something like:

NotifyBuilder notify = new NotifyBuilder(context)
 
.wereSentTo(jms:queue:testResult1).filter(header(MyHeader).isEqualTo(Trace1.1)).whenDoneSatisfied(notifyMock)
  .and()
 
.fromRoute(SUT_ROUTE_ID).filter(body().isNotEqualTo(Trace1.1)).whenDone(1).create();

The second expression may be redundant...




--
View this message in context: 
http://camel.465427.n5.nabble.com/Wiretap-adds-exchanges-to-MockEndpoint-used-in-NotifyBuilder-expression-tp5759085p5759154.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Best way to discard changes made to Exchange by invoked route

2014-11-14 Thread Camel Guy
Follow up... I discovered that enrich etc. hide property removal but not
property modification. So after switching over to properties, which I think
is better (with the exception that there is no removeProperties in Spring
XML), only split does what I need. ~cg

On Tuesday, November 11, 2014, Camel Guy ca...@devguy.com wrote:

 Hi Claus,

 Indeed, after running a test program, I confirmed that enrich and
 recipientList 'hide' changes made to properties but not to headers.
 This is not the case, however, for dynamicRouter, which doesn't hide
 changes made to headers or properties.

 split works for headers in addition to properties -- I imagine that
 seda does as well.

 Is enrich more efficient than split? Wondering if it's worth changing
 the code to use properties.


 Thanks!
 cg

 On Tue, Nov 11, 2014 at 9:30 AM, Claus Ibsen claus.ib...@gmail.com
 javascript:; wrote:
  You can store information as exchange properties and they stick around
 
  On Tue, Nov 11, 2014 at 6:00 PM, Camel Guy ca...@devguy.com
 javascript:; wrote:
  Hi Claus,
 
  Thank you again for your reply. Unfortunately I did not see anything
  in that FAQ that relates to my problem.
 
  From route A, I am invoking route B (serially) that deletes a header
  key. I would like the header key to exist for route A afterwards even
  though route B deleted it. Using a splitter works great. I can not get
  enrich or recipientList to work.
 
  This is a contrived example. The general use case is invoking routes
  without side-effects so they can be called recursively -- as
  subroutines.
 
 
  Thanks,
 
  cg
 
  On Tue, Nov 11, 2014 at 12:00 AM, Claus Ibsen claus.ib...@gmail.com
 javascript:; wrote:
  See this FAQ
  http://camel.apache.org/why-is-my-message-body-empty.html
 
  On Tue, Nov 11, 2014 at 8:22 AM, Camel Guy ca...@devguy.com
 javascript:; wrote:
  Hi Claus,
 
  Thanks for the pointer!
 
  This program logs INFO hello followed by an empty INFO message. I
  would like the second logged message to also be INFO hello.
 
  Am I doing something wrong?
 
  Camel 2.14.0
 
 
  Thank you,
  ~cg
 
  route
from uri=direct:Test/
setHeader headerName='bar'constanthello/constant/setHeader
log message=${header.bar}/
enrich uri=direct:Foo/
log message=${header.bar}/
  /route
 
  route
from uri=direct:Foo/
removeHeader headerName='bar'/
  /route
 
  On Mon, Nov 10, 2014 at 10:06 PM, Claus Ibsen claus.ib...@gmail.com
 javascript:; wrote:
  See about the content enricher
 
  On Tue, Nov 11, 2014 at 4:21 AM, Camel Guy ca...@devguy.com
 javascript:; wrote:
  Hello,
 
  I am using Spring XML. I would like to invoke a route synchronously,
  passing the current Exchange. However, I want to discard the changes
  that the invoked route makes to the Exchange (e.g., modification of
  headers).
 
  So far this is the shortest recipe that results in the desired
 behavior:
 
  splitconstant1/constantto uri=direct:Foo//split
 
  Is there a more elegant way to do this?
 
  I tried
 recipientListconstantdirect:Foo/constant/recipientList
  but the current Exchange was modified.
 
 
  Thanks,
  ~cg
 
 
 
 
  --
  Claus Ibsen
  -
  Red Hat, Inc.
  Email: cib...@redhat.com javascript:;
  Twitter: davsclaus
  Blog: http://davsclaus.com
  Author of Camel in Action: http://www.manning.com/ibsen
  hawtio: http://hawt.io/
  fabric8: http://fabric8.io/
 
 
 
  --
  Claus Ibsen
  -
  Red Hat, Inc.
  Email: cib...@redhat.com javascript:;
  Twitter: davsclaus
  Blog: http://davsclaus.com
  Author of Camel in Action: http://www.manning.com/ibsen
  hawtio: http://hawt.io/
  fabric8: http://fabric8.io/



Re: CXF - Error starting route with CXF endpoint

2014-11-14 Thread Willem Jiang
Can you double check if you start the CXF endpoint twice?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On November 14, 2014 at 8:53:33 PM, contactreji (contactr...@gmail.com) wrote:
 Hey
  
 I get following exception while starting my route with CXF. I guess my
 project was executing fine till 2 days back. But today I have this issue.
  
 *Error occurred while running main from: org.apache.camel.spring.Main
 java.lang.reflect.InvocationTargetException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
  
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   
 at java.lang.reflect.Method.invoke(Method.java:606)
 at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:440)
 at java.lang.Thread.run(Thread.java:745)
 Caused by: org.apache.camel.RuntimeCamelException:
 java.lang.RuntimeException: Soap 1.1 endpoint already registered on address
 http://D-113063918:9191/mes/bw/MEStoBW_Material
 at
 org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1280)
   
 at
 org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)
   
 at
 org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:280)
   
 at
 org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
   
 at
 org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)*
   
  
 I am posting my camel route file for your reference
  
 *
  
  
  
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:camel=http://camel.apache.org/schema/spring;
 xmlns:jaxws=http://cxf.apache.org/jaxws;
 xmlns:osgi=http://www.springframework.org/schema/osgi;
 xmlns:cxf=http://camel.apache.org/schema/cxf;
 xmlns:http-conf=http://cxf.apache.org/transports/http/configuration;
 xmlns:http=http://cxf.apache.org/transports/http/configuration;
 xmlns:sec=http://cxf.apache.org/configuration/security;
 xmlns:ctx=http://www.springframework.org/schema/context;
 xsi:schemaLocation=
 http://camel.apache.org/schema/cxf
 http://camel.apache.org/schema/cxf/camel-cxf.xsd
 http://cxf.apache.org/bindings/soap
 http://cxf.apache.org/schemas/configuration/soap.xsd
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
 http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
 http://camel.apache.org/schema/spring
 http://camel.apache.org/schema/spring/camel-spring.xsd
 http://www.springframework.org/schema/osgi
 http://www.springframework.org/schema/osgi/spring-osgi.xsd
 http://cxf.apache.org/configuration/security
 http://cxf.apache.org/schemas/configuration/security.xsd
 http://cxf.apache.org/transports/http/configuration
 http://cxf.apache.org/schemas/configuration/http-conf.xsd
 http://www.springframework.org/schema/context
 http://www.springframework.org/schema/context/spring-context.xsd
  
 
  
   
 location=file:D:/FactoryESB-PropertyFiles/ID_Name.properties,file:D:/FactoryESB-PropertyFiles/utility.properties
   
 /
  
  
  
   
 serviceClass=outotec.pi.mes.id52.materialconsumptions.SIID52MaterialConsumptionAsyncOut
   
 wsdlURL=wsdl/SI_ID52_MaterialConsumption_async_outService.wsdl
 serviceName=ons:SI_ID52_MaterialConsumption_async_outService
 endpointName=ons:HTTP_Port
 xmlns:ons=urn:outotec:pi:mes:id52:MaterialConsumptions
 xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/;
  
  
  
  
  class=org.apache.activemq.ActiveMQConnectionFactory
  
  
  
  
  class=org.apache.activemq.pool.PooledConnectionFactory
 init-method=start destroy-method=stop
  
  
  
  
  class=org.apache.camel.component.jms.JmsConfiguration
  
  
  
  
  class=org.apache.activemq.camel.component.ActiveMQComponent
  
  
  
  
   
 location=file:D:/FactoryESB-PropertyFiles/ID_Name.properties,file:D:/FactoryESB-PropertyFiles/utility.properties
   
 id=placeholder /
  
  
  
  
 Exception Handler Startes
 java.lang.Exception
  
 true
  
  
 ${exception}
  
  
  logName=Exception_{{interfaceID}}{{interfaceName}} /
  
  
  
  
  
  
  
  
  
  
  
 TXN_${date:now:MMdd}${bean:dateClass?method=currentTimeMillis}  
  
  
 {{sourceSystem}}
  
  
 {{receiverSystem}}
  
  
 {{interfaceID}}
  
  
 {{interfaceName}}
  
  
 {{fuseArchivePath}}/{{FuseArchiveDirectoryName}}
  
  
 {{FuseArchiveDirectoryName}}
  
  
  
  
 received
  
  
  
 ${date:now:MMdd}${bean:dateClass?method=currentTimeMillis}  
  
  
  
  
  loggingLevel=INFO logName=Archived -
 {{interfaceID}}:{{interfaceName}}
  
  
  loggingLevel=INFO
 logName=DispatchNotice_{{interfaceID}}:{{interfaceName}} /
  /
  
  
  
  
  
  
  
  
  
  
 ${header.CamelFileNameOnly}
  
  
  /