RE: Apache camel mime-multipart usage and examples?

2016-04-07 Thread Siano, Stephan
Hi,

Which camel version are you using? MIME-Multipart is only available starting 
Camel 2.17.0.

I am not 100% sure, but your response looks somewhat like SOAP with attachments 
or MTOM. If you are using some kind of Camel-CXF endpoint for receiving it, the 
endpoint might parse it for you.

Best regards
Stephan

-Original Message-
From: ekta.v.wadhw...@accenture.com [mailto:ekta.v.wadhw...@accenture.com] 
Sent: Donnerstag, 7. April 2016 19:18
To: users@camel.apache.org; d...@camel.apache.org
Subject: Apache camel mime-multipart usage and examples?

Hi Team,

Jboss Fuse Studio : Version: 8.1.0.GA
Jdk version: 1.8.0_73
Using XML DSL

Scenario:
Webservice SOAP response is received in multiparts as below:
response : --=_Part_4706_434840889.1459343688908
Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"
Content-Transfer-Encoding: 8bit
Content-ID: 


http://schemas.xmlsoap.org/soap/envelope/;
xmlns:wsa="http://www.w3.org/2005/08/addressing;>
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService//ErpIntegrationService/downloadESSJobExecutionDetailsResponseurn:uuid:82d7d264-ef7f-41da-8d51-79e940413b13http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/;>http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/;
xmlns:ns1="http://xmlns.oracle.com/adf/svc/types/; xmlns:ns0="
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
xsi:type="ns0:DocumentDetails">http://www.w3.org/2004/08/xop/include;
href="cid:51e0b71c-160b-4921-a8a7-8fe7f87ccc3b"/>zipESS_L_157463G4S.Integration.UserAttachments157463.zip
--=_Part_4706_434840889.1459343688908
Content-Transfer-Encoding: binary
Content-ID: <51e0b71c-160b-4921-a8a7-8fe7f87ccc3b>

PK157463.log?XKS?8??W??jTL?  .. blah blah some binary content
--=_Part_4706_434840889.1459343688908--


Can i use apache camel mime-multipart to process this soap response
http://camel.apache.org/mime-multipart.html

As mentioned in this document, i have included the dependency. however i am not 
able to declare this dataFormat in  element.
Can you please help guide with some example using" XML DSL" ? There is no 
example available online.


Thanks,

Ekta



This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise confidential information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the e-mail by you is prohibited. Where allowed by local law, electronic 
communications with Accenture and its affiliates, including e-mail and instant 
messaging (including content), may be scanned by our systems for the purposes 
of information security and assessment of internal compliance with Accenture 
policy.
__

www.accenture.com


Camel 2.15.5: exception propagation with seda queue

2016-04-07 Thread Sven Bauhan

Hi,

I have a problem using a seda queue when propagating an exception to a 
caller route using errorHandler(noErrorHandler()).


What I want to achieve is to wait for a response message and sending an 
exception to a caller route outside a camel context component, if no 
response received within a timeout.


Therefor I build the following routes:

private final String internalSendUri = "direct:internal_send";
private final String internalRespUri = "direct:internal_resp";
private final String internalRespTimeout = "seda:internaltimeout";

public void configure() {
SendController send_controller = new SendController();
TimeoutResponse resp = new TimeoutResponse();

from(Endpoints.MESSAGE_IN.direct())
.routeId(Endpoints.MESSAGE_IN.atsm())
.log("Incoming message at segment in")
.errorHandler(noErrorHandler()) // propagate 
exceptions to caller route

.process(send_controller)
.log("Message after send controller")
.multicast().parallelProcessing()
.log("After wiretap")
.to(internalRespTimeout, 
Endpoints.SEGMENT_OUT.direct());

from(internalRespTimeout)
.routeId(internalRespTimeout)
.log("begin response route")
.errorHandler(noErrorHandler()) // propagate 
exceptions to caller route

.log("timeout response route")
.process(resp)
.log("modify message to response")
.delay(1000)
.log("after delay")
.to(internalRespUri);
from(Endpoints.SEGMENT_IN.seda())
.routeId(Endpoints.SEGMENT_IN.atsm())
.to(internalRespUri);
from(internalRespUri)
.routeId(internalRespUri)
.errorHandler(noErrorHandler()) // propagate 
exceptions to caller route

.log("after response gathering point")
.choice()
.when(header(HeaderKeys.TYPE.key()).isEqualTo(UserMessageType.RESP.toString()))
.log("process responses")
.process(send_controller)
.otherwise()
.log("no response")
.to(Endpoints.MESSAGE_OUT.direct());
}

In the test class I provided the route:

public void configure() throws Exception {
ExceptionTestProcessor exc_proc = new 
ExceptionTestProcessor();

onException(MessageSendException.class).handled(true).process(exc_proc);

from(Endpoints.MESSAGE_IN.uri("direct")).to(Endpoints.MESSAGE_IN.atsm());
from(Endpoints.SEGMENT_IN.uri("direct")).to(Endpoints.SEGMENT_IN.atsm());
from(Endpoints.SEGMENT_OUT.atsm()).routeId(Endpoints.SEGMENT_OUT.uri("test")).log("Send 
out segment '${in.body}'").to(Endpoints.SEGMENT_OUT.uri("mock"));

from(Endpoints.MESSAGE_OUT.atsm())
.routeId(Endpoints.MESSAGE_OUT.uri("test"))
.log("Received message '${in.body}'")
.to(Endpoints.MESSAGE_OUT.uri("mock"));
}

Then I performed a test:

@Test
public void test_exception_on_response_timeout() throws 
InterruptedException {

final String mId = "StatusOk-msg";
final String msg_text = "simple message text";

logger.info("Testing timeout exception");

// test mock-ups
final MockEndpoint msg_out = 
getMockEndpoint(Endpoints.MESSAGE_OUT.uri("mock"));
final MockEndpoint segm_out = 
getMockEndpoint(Endpoints.SEGMENT_OUT.uri("mock"));


segm_out.expectedBodiesReceived(msg_text);
msg_out.expectedMessageCount(0);

// --- send messages ---
Map headers = new HashMap();
headers.put(HeaderKeys.TYPE.key(), UserMessageType.AFTN.value());
try {
template.sendBodyAndHeaders(Endpoints.MESSAGE_IN.direct(),
msg_text, headers);
Thread.sleep(2000);
} catch (CamelExecutionException ex) {
Throwable internal = ex.getCause();
logger.info("Got exception on camel route: " + 
internal.getLocalizedMessage());

}

// check against expectations
msg_out.assertIsSatisfied();
segm_out.assertIsSatisfied();
}

Performing the test I get:

[  main] DefaultCamelContext INFO  Apache Camel 
2.15.5 (CamelContext: camel-2) started in 0.075 seconds
[  main] SendingTest INFO  Testing timeout 
exception
[  main] atsm:message-in INFO  Incoming message 
at segment in
[  main] SendController INFO  SendController 
processing
[  main] SendController INFO 

JGroups and other routes

2016-04-07 Thread rifazjeoffrey1
Just started observing that when there is JGroups route, the other routes
doesn't seem to start, specifically on the node which is designated as
master/coordinator

Any clue ?




--
View this message in context: 
http://camel.465427.n5.nabble.com/JGroups-and-other-routes-tp5780715.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Zookeeper RoutePolicy failing to create znode

2016-04-07 Thread Minh Tran
I’ve investigated this further and the exception is thrown from the 
ZooKeeper.create method. Camel is actually trying to create a znode with a path 
/regexTest1/192.168.202.25-25829641-de1f-4389-9bb6-2967ea60de1a without 
creating the parent node /regexTest1 first. 

According to the Zookeeper.create method documentation 

"If the parent node does not exist in the ZooKeeper, a KeeperException
 * with error code KeeperException.NoNode will be thrown."

And I don’t see anywhere in Camel’s code where it is creating the parent nodes 
first before attempting to create the final node for master election.

So I removed the path off the uri for the route policy like this

ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy("zookeeper:localhost", 
1);

And it has gotten past that error but now has encountered a different error 
where it has trouble creating a threadpool.

2016-04-08 11:47:15,071 [main] ERROR 
org.apache.camel.component.zookeeper.policy.ZooKeeperElection - Error 
configuring ZookeeperElection
java.lang.IllegalArgumentException: id for thread pool 
org.apache.camel.util.concurrent.RejectableThreadPoolExecutor@1ec912d7[Running, 
pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 
0][Camel-Zookeeper Ops executor] must be specified and not empty
at org.apache.camel.util.ObjectHelper.notEmpty(ObjectHelper.java:351) 
~[camel-core-2.16.0.jar:2.16.0]
at 
org.apache.camel.impl.DefaultExecutorServiceManager.onThreadPoolCreated(DefaultExecutorServiceManager.java:522)
 ~[camel-core-2.16.0.jar:2.16.0]
at 
org.apache.camel.impl.DefaultExecutorServiceManager.newThreadPool(DefaultExecutorServiceManager.java:191)
 ~[camel-core-2.16.0.jar:2.16.0]
at 
org.apache.camel.impl.DefaultExecutorServiceManager.newFixedThreadPool(DefaultExecutorServiceManager.java:230)
 ~[camel-core-2.16.0.jar:2.16.0]
at 
org.apache.camel.component.zookeeper.ZooKeeperConsumer.doStart(ZooKeeperConsumer.java:72)
 ~[camel-zookeeper-2.16.0.jar:2.16.0]
at 
org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 
~[camel-core-2.16.0.jar:2.16.0]
at 
org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3219)
 ~[camel-core-2.16.0.jar:2.16.0]


> On 7 Apr 2016, at 11:44 AM, Minh Tran  wrote:
> 
> Hi
> 
> I am trying to setup a ZooKeeper route policy like this
> 
> ZooKeeperRoutePolicy policy = new 
> ZooKeeperRoutePolicy("zookeeper:localhost/regexTest1?create=true", 1);
> from("direct:start").routePolicy(policy).to(“mock:end”);
> 
> And when I run my unit test to trigger the route, I get the following 
> exception in my logs
> 
> Node '/regexTest1/192.168.202.25-3306c9d2-1354-4dbe-aaff-846eee5bb60d' did 
> not exist, creating it.
> Error setting up election node 
> /regexTest1/192.168.202.25-25829641-de1f-4389-9bb6-2967ea60de1a
> org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = 
> NoNode for /regexTest1/192.168.202.25-25829641-de1f-4389-9bb6-2967ea60de1a
>   at 
> org.apache.zookeeper.KeeperException.create(KeeperException.java:111) 
> ~[zookeeper-3.4.8.jar:3.4.8--1]
>   at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) 
> ~[zookeeper-3.4.8.jar:3.4.8--1]
>   at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783) 
> ~[zookeeper-3.4.8.jar:3.4.8--1]
>   at 
> org.apache.camel.component.zookeeper.operations.CreateOperation.getResult(CreateOperation.java:52)
>  ~[camel-zookeeper-2.17.0.jar:2.17.0]
>   at 
> org.apache.camel.component.zookeeper.operations.ZooKeeperOperation.get(ZooKeeperOperation.java:70)
>  ~[camel-zookeeper-2.17.0.jar:2.17.0]
>   at 
> org.apache.camel.component.zookeeper.ZookeeperProducer.createNode(ZookeeperProducer.java:222)
>  ~[camel-zookeeper-2.17.0.jar:2.17.0]
>   at 
> org.apache.camel.component.zookeeper.ZookeeperProducer.synchronouslySetData(ZookeeperProducer.java:238)
>  ~[camel-zookeeper-2.17.0.jar:2.17.0]
>   at 
> org.apache.camel.component.zookeeper.ZookeeperProducer.process(ZookeeperProducer.java:88)
>  ~[camel-zookeeper-2.17.0.jar:2.17.0]
>   at 
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>  ~[camel-core-2.17.0.jar:2.17.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>  [camel-core-2.17.0.jar:2.17.0]
>   at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
>  [camel-core-2.17.0.jar:2.17.0]
>   at 
> org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:68)
>  [camel-core-2.17.0.jar:2.17.0]
>   at 
> org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:412) 
> [camel-core-2.17.0.jar:2.17.0]
>   at 
> org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:380) 
> [camel-core-2.17.0.jar:2.17.0]
>   at 
> 

Connecting to ActiveMQ by a consumer and a producer - best practice

2016-04-07 Thread hayden74
Hi guys,
I have question related to the best way to connect to ActiveMQ from a
consumer and a producer. So does the way to connect to ActiveMQ from a
consumer and  a producer have to be the same? that is, using caching in both
sides, connection pooling, max number of connections...etc

My current configuration is as below:

Consumer <-> ActiveMQ <-> Producer (where all routes live)

Below is the consumer settings to connect to ActiveMQ



http://www.springframework.org/schema/beans;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
   xmlns:camel="http://camel.apache.org/schema/spring;
   xmlns:jms="http://www.springframework.org/schema/jms;
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://camel.apache.org/schema/spring
   http://camel.apache.org/schema/spring/camel-spring.xsd
   http://www.springframework.org/schema/jms
   http://www.springframework.org/schema/jms/spring-jms.xsd
   ">























 



And this is the producer settings to connect to ActiveMQ


http://www.springframework.org/schema/beans;
   xmlns:context="http://www.springframework.org/schema/context;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
   xmlns:camel="http://camel.apache.org/schema/spring;
   xmlns:p="http://www.springframework.org/schema/p;
   xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd;>
 



   com.wyn.camel.route































Appreciate your input.  



--
View this message in context: 
http://camel.465427.n5.nabble.com/Connecting-to-ActiveMQ-by-a-consumer-and-a-producer-best-practice-tp5780718.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Beanio stream...

2016-04-07 Thread Ranx
Claus,
Please forgive all the @ in here as that was the only way I could post this
to get around the spam filter.

Just to get this working for me so I can start refactoring my code to accept
and process individual items from the unmarshaling of the multi-line beanio
beans I hacked this bit of code.  I don't want to use it but it let's me
proceed until I can get something like this to work with the Camel file
endpoint.

As you can see I'm injecting a seda queue in here to drop the individual
items on and a directory w@tcher to w@tch for incoming files.  My unit test
copies a file over into the directory and I can see the results.  I have to
put the exclusive lock mechanics in there or the bean reader would try to
read the file before it was truly available.  But I don't want to replicate
all the mechanics that are already baked in and hardened in the Camel File
endpoint.

Doing it this way though changes this from a pull mechanism to a
push/publish mechanism that I prefer.

I have a couple of questions about how I might proceed with this.  I'm fine
with reading the Beanio stream/definition from my blueprint bundle with
getResourceAsStream and foregoing the use of the Camel marsahaler itself. 
If I do that, what mecahnics would I use to get a notification from the File
endpoint that a new file has been dropped into the directory.  Just a
standard Camel Processor?  

You'd mentioned an iterator/reader object and noticed some in the BeanIO
code itself but I don't think I saw anything in Camel itself. 

I did try just chunking the raw text but the problem with that is if I read
in a chunk of 100 records the 100th might well fall in the middle of a
record.

Thanks for any insights.

@EndpointInject(uri = "seda:process")
private ProducerTemplate process;

Logger logger = Logger.getLogger(AHSBatchReader.class);

private StreamFactory factory;
private w@tchService w@tcher;
Path dir;

public void init() throws IOException {
logger.info("Starting stream factory...");
// create a StreamFactory
factory = StreamFactory.newInstance();
// load the mapping file...switch to use getResourceAsStream 
from bundle.

factory.load("src/main/resources/dataformats/beanio-ahs-in.xml");

w@tcher = FileSystems.getDefault().neww@tchService();
dir = FileSystems.getDefault().getPath("/test/in");
dir.register(w@tcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
new Thread(this).start();
}

public void run() {
while (true) {
w@tchKey key;
try {
key = w...@tcher.take();

for (w@tchEvent event : key.pollEvents()) {
w...@tchevent.kind kind = event.kind();
w@tchEvent ev = cast(event);
Path name = ev.context();
Path child = dir.resolve(name);

// print out event
System.out.format("%s: %s\n", 
event.kind().name(), child);
if (event.kind() == ENTRY_MODIFY) {
File file = child.toFile();
boolean exclusivelyLocked = 
false;
//Get an exclusive lock on the file if we can.  If we can't then the system
is still using and it we delay start of beanio reading.
while (!exclusivelyLocked) {
try {
FileChannel 
channel = new RandomAccessFile(file, "rw").getChannel();
FileLock lock = 
null;
try {
lock = 
channel.tryLock();


System.out.println(lock);

System.out.println(lock.isShared());

System.out.println(lock.isValid());

exclusivelyLocked = lock.isValid() && !lock.isShared();
} catch 
(Exception e) {
// File 
is open by someone else

Thread.sleep(500);

Re: Understanding Pooled Connection Factory on ActiveMQ

2016-04-07 Thread Quinn Stevenson
The pooled connection factory is a good idea, and it can be used by both the 
producer and consumer - but the connection factory doesn’t determine the number 
of concurrent consumers.

> On Apr 7, 2016, at 10:04 AM, Michele  
> wrote:
> 
> Hi Stevenson,
> 
> I configured component activemq using Pooled Connection Factory. 
> So, PooledConnection Factory regarded only Producer? 
> 
> I try to add a concurrentConsumers as option...
> 
> Thank you so much
> 
> Regards
> 
> Michele
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Understanding-Pooled-Connection-Factory-on-ActiveMQ-tp5780689p5780704.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



Apache camel mime-multipart usage and examples?

2016-04-07 Thread ekta.v.wadhwani
Hi Team,

Jboss Fuse Studio : Version: 8.1.0.GA
Jdk version: 1.8.0_73
Using XML DSL

Scenario:
Webservice SOAP response is received in multiparts as below:
response : --=_Part_4706_434840889.1459343688908
Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"
Content-Transfer-Encoding: 8bit
Content-ID: 


http://schemas.xmlsoap.org/soap/envelope/;
xmlns:wsa="http://www.w3.org/2005/08/addressing;>
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService//ErpIntegrationService/downloadESSJobExecutionDetailsResponseurn:uuid:82d7d264-ef7f-41da-8d51-79e940413b13http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/;>http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/;
xmlns:ns1="http://xmlns.oracle.com/adf/svc/types/; xmlns:ns0="
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
xsi:type="ns0:DocumentDetails">http://www.w3.org/2004/08/xop/include;
href="cid:51e0b71c-160b-4921-a8a7-8fe7f87ccc3b"/>zipESS_L_157463G4S.Integration.UserAttachments157463.zip
--=_Part_4706_434840889.1459343688908
Content-Transfer-Encoding: binary
Content-ID: <51e0b71c-160b-4921-a8a7-8fe7f87ccc3b>

PK157463.log?XKS?8??W??jTL?  .. blah blah some binary content
--=_Part_4706_434840889.1459343688908--


Can i use apache camel mime-multipart to process this soap response
http://camel.apache.org/mime-multipart.html

As mentioned in this document, i have included the dependency. however i am not 
able to declare this dataFormat in  element.
Can you please help guide with some example using" XML DSL" ? There is no 
example available online.


Thanks,

Ekta



This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise confidential information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the e-mail by you is prohibited. Where allowed by local law, electronic 
communications with Accenture and its affiliates, including e-mail and instant 
messaging (including content), may be scanned by our systems for the purposes 
of information security and assessment of internal compliance with Accenture 
policy.
__

www.accenture.com


Camel XML Route with JNDI references.

2016-04-07 Thread kvn098
 Hi all,

What is the current best practice for referencing JNDI inside your XML Camel
Route?   

 @Bean(name = "fileOutputDirectory")
 @Scope(BeanDefinition.SCOPE_SINGLETON)
 public String fileOutputDirectory() {
return simpleJndiBeanFactory().getBean("fileOutputDirectory",
String.class);
 }

 
 
myFile_${date:now:.MM.dd_hh.mm.ss}.xml

  //How to reference this bean in XML
Route?




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-XML-Route-with-JNDI-references-tp5780707.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Understanding Pooled Connection Factory on ActiveMQ

2016-04-07 Thread Michele
 Hi Stevenson,

I configured component activemq using Pooled Connection Factory. 
So, PooledConnection Factory regarded only Producer? 

I try to add a concurrentConsumers as option...

Thank you so much

Regards

Michele



--
View this message in context: 
http://camel.465427.n5.nabble.com/Understanding-Pooled-Connection-Factory-on-ActiveMQ-tp5780689p5780704.html
Sent from the Camel - Users mailing list archive at Nabble.com.


OnException Not returning a custom Response

2016-04-07 Thread rahultaneja
Hi All,
 I have the below scenario and from this I am not able to return a custom
response. Before I brief about the trouble I am facing, Below are the
details:
1) Apache Camel Version -2.16
2) Java version - 1.7
3) Server- Jetty Plugin of Maven
4) Using Apache camel CXF component.



I am having this issue in my apache camel code which I have tried to resolve
from every angle, but I could not resolve it.

1) I have two route as below, First route is as below:

public class XXXRoute1 extends RouteBuilder {
public void configure() {
String endpointUri = "cxf:/XXX;
String logEndpoint = "log:" + XXX() + "?level=DEBUG";
from(endpointUri)
.to(logEndpoint).to(ROUTE2.ENDPOINT_URI)
.to(logEndpoint);
}

Second Route:(In second route , I am catching some exception through
onException)

public class Route2 extends RouteBuilder {
 public void configure() throws  Exception{
String integrationEndpoint = "xxx.integration";
onException(RuntimeException.class).handled(true).onWhen(exceptionMessage().contains("Invalid")).bean(translator,
"translateSomeError(${property.XXX})").end();

from(ENDPOINT_URI)
.
.
. so on

Now , In my case, the object which I am populating through onException

public SomeObjectResponse translateSomeError(Object someObject) throws 
Exception{


SomeObjectResponse someObjectResponse = new SomeObjectResponse();
someObjectResponse.setError("someError");

return someObjectResponse ;
}

However, In SOAP UI while testing I am getting an emplty SOAP envelop

http://schemas.xmlsoap.org/soap/envelope/;>
   


I am using cxf component in apache camel. Thanks in advance for looking into
this issue.

The above response comes,I have tried the following things doTry,
onException, Different properties of exchange set, even try catch block in
java has been tried but same response.



--
View this message in context: 
http://camel.465427.n5.nabble.com/OnException-Not-returning-a-custom-Response-tp5780706.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: infinispan Idempotent and RemoteCacheManager

2016-04-07 Thread lb
In your new route you have skipDuplicate="false" so it won't block any
message



--
View this message in context: 
http://camel.465427.n5.nabble.com/infinispan-Idempotent-and-RemoteCacheManager-tp5780600p5780705.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Bridging a HTTPS endpoint using HTTP4 Camel component

2016-04-07 Thread cubiks
Hello,

I had recently have to move from using Jetty component on the producer side
to using Camel Http4 component, here is an example:


  http://0.0.0.0:{{port}}/bridgeWithJetty?matchOnUriPrefix=true; />
  ...
  https://{{host}}/{{ctxPath}}/?bridgeEndpoint=true; />



  http://0.0.0.0:{{port}}/bridgeWithHttp4?matchOnUriPrefix=true; />
  ...
  


The endpoint I am trying to bridge is using SSL, which with jetty component
on the producer (client) side was not a problem.
After changing to HTTP4 I am seeing this error:

Caused by: sun.security.validator.ValidatorException: PKIX path building
failed: sun.security.provider.certpath.SunCertPathBuilderException: unable
to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
at
sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
at sun.security.validator.Validator.validate(Validator.java:260)
at
sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
at
sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
at
sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
at
sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491)
... 54 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
at
sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:146)
at
sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
... 60 more

I don't really understand this error, since I'm a client of this endpoint
why is it looking for certificates?
Is this happening because I am bridging?
Could you provide any hints on how I can solve this or why this is behaving
differently than when using the jetty component?

Many thanks,
Daniel



--
View this message in context: 
http://camel.465427.n5.nabble.com/Bridging-a-HTTPS-endpoint-using-HTTP4-Camel-component-tp5780703.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: [Bug?] hl7dataformat hapicontext not in camel-blueprint.xsd

2016-04-07 Thread Claus Ibsen
The online xsd schemas are not always 100% up to date with the latest
release. The xsd's are in the JARs which your IDE and also the xml
parser should use at runtime. Should not rely on internet to an ASF
website.

On Mon, Apr 4, 2016 at 10:19 AM, Walzer, Thomas
 wrote:
> Hi,
>
> is it possible that 
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd does not contain 
> the new properties hapiContext & parser?
> Makes it hard to use the features from 2.14.1 in blueprint ;-)
>
> Jira?
>
> Cheers, Thomas.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Understanding Pooled Connection Factory on ActiveMQ

2016-04-07 Thread Quinn Stevenson
Your consuming route only defines one consumer (i.e. concurrentConsumers is not 
set, so it defaults to 1).  Try increasing that.



> On Apr 7, 2016, at 7:10 AM, Michele  wrote:
> 
> Hi everyone,
> 
> I use ActiveMQ Component for my use case that foresee:
> 
> 1. Read file from folder wich main cotain large number of line
> 2. Split with stream, Process each line and then store it in Active MQ
> 3. Consumers recieves messages from queue and then to invoke a Rest Service.
> 
> I defined a Pooled Connection Factory on ActiveMQ like this
> 
>  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">
>   
> 
> 
> and Route like this
> 
> 
>
> 
>   
>   
>   
>   
>   
> 
> 
> 
> 
>  uri="activemq:queue:incomingTickets?destination.consumer.prefetchSize=0" />
> 
>  5   
>uri="jetty:http://host/rs/v1.0/ticket?jettyHttpBindingRef=CustomJettyHttpBinding;
> />
>  
> 
> 
> To resolve OutOfMemory problem on Active MQ I increased heap and I changed
> activemq.xml like this:
> 
>  optimizedDispatch="true" />
>
> During test, I observed that only one Consumer works on the broker to
> dequeue like image attached  pooled-connection.png
>   .
> Why this?
> 
> But, Does Pooled Connection Factory work only onproducer side (Push message
> in queue)?
> How I obtain a cuncurrentConsumers on consumer side (Pop message from
> queue)?
> 
> 
> Environment: JBoss Fuse 6.2 based on Apache Camel and ActiveMQ.
> 
> Thanks in advance
> 
> Best Regards
> 
> Michele
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Understanding-Pooled-Connection-Factory-on-ActiveMQ-tp5780689.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



Re: [Bug?] hl7dataformat hapicontext not in camel-blueprint.xsd

2016-04-07 Thread Quinn Stevenson
If you can share your Java configuration, I’ll see if I can convert it to 
Blueprint.

As far as the XSD change - I can’t answer that one for certain, but I’d guess 
the answer is no.  Looking at the other definitions in the XSD, the attributes 
appear to be primitive types (String, boolean, etc).  I didn’t check all of 
them - just gave the XSD a quick look.  Since the parser and context on the HL7 
DataFormat are not primitive types, I’d guess the XSD won’t change and you’d 
need to revert to configuring the bean - but that’s just my guess.


> On Apr 7, 2016, at 8:23 AM, Walzer, Thomas  
> wrote:
> 
> I got it to work without blueprint (in java). Blueprint wiring was a bit too 
> complex for me. If anyone has a working example I will gladly add it to the 
> docs.
> 
> Should we add those elements to the xsd?
> 
> Cheers, Thomas.
> 
>> Am 05.04.2016 um 16:36 schrieb Quinn Stevenson :
>> 
>> I learned something new - I’ve never used the camel:dataFormats element 
>> before.
>> 
>> I normally do something like this
>> > class="org.apache.camel.component.hl7.HL7DataFormat" >
>>   
>>   
>> 
>> 
>> You’d have to define “my-parser” as well, but I think this will work.
>> 
>> 
>> 
>>> On Apr 5, 2016, at 12:03 AM, Walzer, Thomas  
>>> wrote:
>>> 
>>> When I write the blueprint xml I have a reference to camel-blueprint.xsd in 
>>> it. So that the tooling can check my xml against the xsd.
>>> 
>>> --snip from camel-blueprint.xsd ---
>>> 
>>> 
>>>  
>>>
>>>  
>>>  
>>>
>>>  Whether to validate the HL7 
>>> message Is by default true.
>>>
>>>  
>>>
>>>  
>>> 
>>> 
>>> --end snip 
>>> 
>>> From the docs it should be  more like
>>> 
>>> 
>>>  
>>>
>>>  
>>>  
>>>
>>>  Whether to validate the HL7 
>>> message Is by default true.
>>>
>>>  
>>>  
>>>
>>>  The hapiContext to 
>>> use
>>>
>>>  
>>>  
>>>
>>>  The parser to 
>>> use
>>>
>>>  
>>>
>>>  
>>> 
>>> 
>>> So for instance the following snippet in my blueprint
>>>  
>>> 
>>> 
>>> 
>>> yields:
>>> 
>>> cvc-complex-type.3.2.2: Attribute 'parser' is not allowed to appear in 
>>> element 'camel:hl7'.
>>> 
>>> This happens not only when validating the source but also when starting up, 
>>> as the blueprint gets validated again.
>>> 
>>> Cheers, Thomas.
>>> 
>>> -Ursprüngliche Nachricht-
>>> Von: Quinn Stevenson [mailto:qu...@pronoia-solutions.com] 
>>> Gesendet: Montag, 04. April 2016 17:17
>>> An: users@camel.apache.org
>>> Betreff: Re: [Bug?] hl7dataformat hapicontext not in 
>>> camel-blueprint.xsd
>>> 
>>> As far as I know, Blueprint uses reflection to set properties so there 
>>> wouldn’t be any need for any changes in camel-blueprint when a 
>>> component/dataformat gets new properties.
>>> 
>>> What exactly is your issue?
>>> 
 On Apr 4, 2016, at 2:19 AM, Walzer, Thomas  
 wrote:
 
 Hi,
 
 is it possible that 
 http://camel.apache.org/schema/blueprint/camel-blueprint.xsd does not 
 contain the new properties hapiContext & parser?
 Makes it hard to use the features from 2.14.1 in blueprint ;-)
 
 Jira?
 
 Cheers, Thomas.
>>> 
>> 
> 



Re: Spring ldap configuration problem

2016-04-07 Thread Claus Ibsen
Yeah and also dig up that source code line number where the NPE is to
maybe try to know what is null and maybe try to reason why it may be
null. Maybe some of that spring ldap template lookup stuff is not
correct

On Thu, Apr 7, 2016 at 4:20 PM, Walzer, Thomas
 wrote:
> Sorry, I have only generic ideas:
>
> Have you tried the „normal/non-spring“ ldap-component?
> Have you tried to set Debug to TRACE?
>
> Cheers, Thomas.
>
>> Am 06.04.2016 um 07:06 schrieb Claus Ibsen :
>>
>> That is an old Camel version. You can try using a newer version.
>>
>> On Tue, Apr 5, 2016 at 4:46 PM, rburdet  wrote:
>>> Camel version: 2.12.0
>>>
>>> Stacktrace:
>>>
>>> Message History
>>> ---
>>> RouteId  ProcessorId  Processor
>>> Elapsed (ms)
>>> [timerToLog] [timerToLog] [timer://timerName?period=10
>>> ] [10]
>>> [timerToLog] [setBody1  ]
>>> [setBody[constant{filter=(ou=mathematicians)}]
>>> ] [ 3]
>>> [timerToLog] [to1   ]
>>> [spring-ldap:template?operation=search
>>> ] [ 4]
>>>
>>> Exchange
>>> ---
>>> Exchange[
>>>Id  ID-localhost-localdomain-45540-1459867547898-0-2
>>>ExchangePattern InOnly
>>>Headers
>>> {breadcrumbId=ID-localhost-localdomain-45540-1459867547898-0-1,
>>> CamelRedelivered=false, CamelRedeliveryCounter=0, firedTime=Tue Apr 05
>>> 11:45:49 ART 2016}
>>>BodyTypeString
>>>Bodyfilter=(ou=mathematicians)
>>> ]
>>>
>>> Stacktrace
>>> ---
>>> java.lang.NullPointerException
>>>at
>>> org.apache.camel.component.springldap.SpringLdapProducer.process(SpringLdapProducer.java:69)
>>>at
>>> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>>>at
>>> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:132)
>>>at
>>> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:307)
>>>at 
>>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:127)
>>>at
>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
>>>at
>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
>>>at
>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
>>>at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
>>>at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
>>>at
>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
>>>at
>>> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:139)
>>>at
>>> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:64)
>>>at java.util.TimerThread.mainLoop(Timer.java:555)
>>>at java.util.TimerThread.run(Timer.java:505)
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context: 
>>> http://camel.465427.n5.nabble.com/Spring-ldap-configuration-problem-tp5780463p5780499.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: [Bug?] hl7dataformat hapicontext not in camel-blueprint.xsd

2016-04-07 Thread Walzer, Thomas
I got it to work without blueprint (in java). Blueprint wiring was a bit too 
complex for me. If anyone has a working example I will gladly add it to the 
docs.

Should we add those elements to the xsd?

Cheers, Thomas.

> Am 05.04.2016 um 16:36 schrieb Quinn Stevenson :
> 
> I learned something new - I’ve never used the camel:dataFormats element 
> before.
> 
> I normally do something like this
>  class="org.apache.camel.component.hl7.HL7DataFormat" >
>
>
> 
> 
> You’d have to define “my-parser” as well, but I think this will work.
> 
> 
> 
>> On Apr 5, 2016, at 12:03 AM, Walzer, Thomas  
>> wrote:
>> 
>> When I write the blueprint xml I have a reference to camel-blueprint.xsd in 
>> it. So that the tooling can check my xml against the xsd.
>> 
>> --snip from camel-blueprint.xsd ---
>> 
>> 
>>   
>> 
>>   
>>   
>> 
>>   Whether to validate the HL7 
>> message Is by default true.
>> 
>>   
>> 
>>   
>> 
>> 
>> --end snip 
>> 
>> From the docs it should be  more like
>> 
>> 
>>   
>> 
>>   
>>   
>> 
>>   Whether to validate the HL7 
>> message Is by default true.
>> 
>>   
>>   
>> 
>>   The hapiContext to 
>> use
>> 
>>   
>>   
>> 
>>   The parser to 
>> use
>> 
>>   
>> 
>>   
>> 
>> 
>> So for instance the following snippet in my blueprint
>>  
>>  
>> 
>> 
>> yields:
>> 
>> cvc-complex-type.3.2.2: Attribute 'parser' is not allowed to appear in 
>> element 'camel:hl7'.
>> 
>> This happens not only when validating the source but also when starting up, 
>> as the blueprint gets validated again.
>> 
>> Cheers, Thomas.
>> 
>> -Ursprüngliche Nachricht-
>> Von: Quinn Stevenson [mailto:qu...@pronoia-solutions.com] 
>> Gesendet: Montag, 04. April 2016 17:17
>> An: users@camel.apache.org
>> Betreff: Re: [Bug?] hl7dataformat hapicontext not in 
>> camel-blueprint.xsd
>> 
>> As far as I know, Blueprint uses reflection to set properties so there 
>> wouldn’t be any need for any changes in camel-blueprint when a 
>> component/dataformat gets new properties.
>> 
>> What exactly is your issue?
>> 
>>> On Apr 4, 2016, at 2:19 AM, Walzer, Thomas  
>>> wrote:
>>> 
>>> Hi,
>>> 
>>> is it possible that 
>>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd does not 
>>> contain the new properties hapiContext & parser?
>>> Makes it hard to use the features from 2.14.1 in blueprint ;-)
>>> 
>>> Jira?
>>> 
>>> Cheers, Thomas.
>> 
> 



Re: Spring ldap configuration problem

2016-04-07 Thread Walzer, Thomas
Sorry, I have only generic ideas:

Have you tried the „normal/non-spring“ ldap-component?
Have you tried to set Debug to TRACE?

Cheers, Thomas.

> Am 06.04.2016 um 07:06 schrieb Claus Ibsen :
> 
> That is an old Camel version. You can try using a newer version.
> 
> On Tue, Apr 5, 2016 at 4:46 PM, rburdet  wrote:
>> Camel version: 2.12.0
>> 
>> Stacktrace:
>> 
>> Message History
>> ---
>> RouteId  ProcessorId  Processor
>> Elapsed (ms)
>> [timerToLog] [timerToLog] [timer://timerName?period=10
>> ] [10]
>> [timerToLog] [setBody1  ]
>> [setBody[constant{filter=(ou=mathematicians)}]
>> ] [ 3]
>> [timerToLog] [to1   ]
>> [spring-ldap:template?operation=search
>> ] [ 4]
>> 
>> Exchange
>> ---
>> Exchange[
>>Id  ID-localhost-localdomain-45540-1459867547898-0-2
>>ExchangePattern InOnly
>>Headers
>> {breadcrumbId=ID-localhost-localdomain-45540-1459867547898-0-1,
>> CamelRedelivered=false, CamelRedeliveryCounter=0, firedTime=Tue Apr 05
>> 11:45:49 ART 2016}
>>BodyTypeString
>>Bodyfilter=(ou=mathematicians)
>> ]
>> 
>> Stacktrace
>> ---
>> java.lang.NullPointerException
>>at
>> org.apache.camel.component.springldap.SpringLdapProducer.process(SpringLdapProducer.java:69)
>>at
>> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>>at
>> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:132)
>>at
>> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:307)
>>at 
>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:127)
>>at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
>>at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
>>at
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
>>at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
>>at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
>>at
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
>>at
>> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:139)
>>at
>> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:64)
>>at java.util.TimerThread.mainLoop(Timer.java:555)
>>at java.util.TimerThread.run(Timer.java:505)
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Spring-ldap-configuration-problem-tp5780463p5780499.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



Understanding Pooled Connection Factory on ActiveMQ

2016-04-07 Thread Michele
Hi everyone,

I use ActiveMQ Component for my use case that foresee:

1. Read file from folder wich main cotain large number of line
2. Split with stream, Process each line and then store it in Active MQ
3. Consumers recieves messages from queue and then to invoke a Rest Service.

I defined a Pooled Connection Factory on ActiveMQ like this























and Route like this



 
   
   
   
   
   
 



 
 
  5   
   http://host/rs/v1.0/ticket?jettyHttpBindingRef=CustomJettyHttpBinding;
/>
  


To resolve OutOfMemory problem on Active MQ I increased heap and I changed
activemq.xml like this:


 
During test, I observed that only one Consumer works on the broker to
dequeue like image attached  pooled-connection.png
  .
Why this?

But, Does Pooled Connection Factory work only onproducer side (Push message
in queue)?
How I obtain a cuncurrentConsumers on consumer side (Pop message from
queue)?


Environment: JBoss Fuse 6.2 based on Apache Camel and ActiveMQ.

Thanks in advance

Best Regards

Michele










--
View this message in context: 
http://camel.465427.n5.nabble.com/Understanding-Pooled-Connection-Factory-on-ActiveMQ-tp5780689.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Cache Streaming Treat large file

2016-04-07 Thread kikou1984
Hi,

I’m working on a subject “Using Cache with Apache Camel and How to treat
large file”.

The purpose is to treat large file with camel without loading the file into
memory because it’s a huge file over 5 GO.

We found several tracks, the first track is to use the splitter component,
to allow us to read the file for example line by line or block by block,
however if we use the splitter we are not able to read again the file from
the beginning, a functional need is to be able to read some part of the file
even when the split is finished. 

So we have to use a cache system, to put blocks in the cache to reuse them.

So we thought that is was compulsory to use the class CachedOutputStream to
write on disk some part of the file after the splitter , this class also
provides the ability to encrypt data on disk.


example below :

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
















${in.header.CamelSplitComplete} == "true"









   
${header.CamelFileName}.${header.CamelSplitIndex}






The method dealRecord  puts each line splitted into a cache: 

public void dealRecord(Exchange exchange) throws Exception {

   String body;
   File file;
   String[] files;
   boolean isSplitComplete;

   body = (String) exchange.getIn().getBody();
   isSplitComplete = (boolean)
exchange.getProperties().get("CamelSplitComplete");

   CachedOutputStream cos = new CachedOutputStream(exchange, false);
   cos.write(body.getBytes("UTF-8"));

   file = new File("target/cachedir");
   files = file.list();
   for (String nameTmpfile : files) {
  LOG.info("Genered File [" + nameTmpfile + "]");
   }
   
   lstCache.add(cos);

   if(isSplitComplete){
  exchange.getIn().setHeader("Cached",lstCache);
   }
}

The method usingStream,can use each cache existing in the header 

public byte[] usingStream(Exchange exchange) throws InputStreamException {

   final ArrayList lstcache;
   byte[] bytesMessage;
   StringBuilder messageCompleteOut = new StringBuilder();
   InputStream is = null;

   lstcache = (ArrayList)
exchange.getIn().getHeader("Cached");
   for (CachedOutputStream oneCache : lstcache) {
  try {
 is = oneCache.getWrappedInputStream();
 String messageInputstream = toString(is);
 LOG.info("Message of Cache ["+ messageInputstream +"]");
 messageCompleteOut.append(messageInputstream);
 messageCompleteOut.append(System.lineSeparator());
  } catch (IOException e) {

LOG.error(InputStreamException.ERROR_MANIPULATING_INPUT_STREAM_CHANNEL);
 throw new
InputStreamException(InputStreamException.ERROR_MANIPULATING_INPUT_STREAM_CHANNEL,e);
  }
  // On ferme le flux
  IOHelper.close(is);
   }
   bytesMessage =
messageCompleteOut.toString().getBytes(Charset.forName("UTF-8"));
   return bytesMessage;
}

Is that solution seems ok  ? or maybe there is a better way ?

thxs




--
View this message in context: 
http://camel.465427.n5.nabble.com/Cache-Streaming-Treat-large-file-tp5780687.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Isolating header into route

2016-04-07 Thread fabryprog
Hello,

how to force my route to ISOLATING her headers?

I have this flow:

route A1
 - set CamelSqlQuery

route A2
 - set CamelSqlQuery

route B
 - execute sql based on CamelSqlQuery header

Interceptor
 - execute more sql to check permission using own CamelSqlQuery header
 - remove CamelSqlQuery header (to avoid security violation)

Now, when invoke RouteA1 (or RouteA2) followed by RouteB my interceptor
delete my CamelSqlQuery!!

There are any method to ISOLATE header into any route? It would be a private
java method.

thanks




--
View this message in context: 
http://camel.465427.n5.nabble.com/Isolating-header-into-route-tp5780684.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: DefaultSqlPrepareStatementStrategy lookupParameter when onConsume used in SQL component

2016-04-07 Thread onders
thanks for the guidance.



--
View this message in context: 
http://camel.465427.n5.nabble.com/DefaultSqlPrepareStatementStrategy-lookupParameter-when-onConsume-used-in-SQL-component-tp5780437p5780671.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: JMS vs MQ message

2016-04-07 Thread #S-SmixDev
targetClient=1 means there are no headers except the standard properties
from the MQMD header on the message. You can not send custom headers that
way.

And specifying the targetClient does not have any effect whatsoever when
reading messages from a  queue.

Regards,
Jens



Von:blommis 
An: users@camel.apache.org,
Datum:  07.04.2016 11:31
Betreff:JMS vs MQ message


I'm trying to receive a JMS message and send it to a MQ queue, keeping
headers on the message.
But headers are sent when using targetClient=1.

So when using the following, no headers are sent.
from("*wmq:queue:A0*").log("${headers}");
template.sendBodyAndHeader("*wmq:queue:A0*", "body", "h1", "headervalue");

However, when having a component called wmqJms (using wmq but without
targetClient=1), it does read headers, even if I have from wmq. But then
when forwarding the message to a wmq component (targetClient=1), there is
no
headers on the A1 queue
from("*wmq:queue:A0*").log("${headers}").to("wmq:queue:A1");
template.sendBodyAndHeader("*wmqJms:queue:A0*", "body", "h1",
"headervalue");


public static Component createMQComponent(Properties properties) throws
JMSException {
JmsComponent jmsComponent = getJmsComponent(properties);
jmsComponent.setDestinationResolver(new DestinationResolver() {
@Override
public Destination resolveDestinationName(Session session,
String destinationName, boolean pubSubDomain) throws JMSException {
MQQueueSession mqSession = (MQQueueSession) session;
return session.createQueue("queue:///" + destinationName +
"?targetClient=1");
}
});
return jmsComponent;
}

private static JmsComponent getJmsComponent(Properties properties)
throws JMSException {
return MQComponentBuilder.mqComponent(
properties.getPropertyNotNull("wmq.hostname"),

Integer.parseInt(properties.getPropertyNotNull("wmq.port")),
properties.getPropertyNotNull("wmq.username"),
properties.getPropertyNotNull("wmq.password"),
properties.getPropertyNotNull("wmq.queueManager"),
properties.getPropertyNotNull("wmq.channel")
);
}



--
View this message in context:
http://camel.465427.n5.nabble.com/JMS-vs-MQ-message-tp5780662.html
Sent from the Camel - Users mailing list archive at Nabble.com.




Re: DefaultSqlPrepareStatementStrategy lookupParameter when onConsume used in SQL component

2016-04-07 Thread Claus Ibsen
The onConsume is run when the exchange is complete at the end,
whatever that means routing over threads and whatnot.

If you want to break up your route into 2 lets, then consider using
wire-tap to fork of a separeted copy that is indepdenent.



On Thu, Apr 7, 2016 at 12:12 PM, onders  wrote:
> Hmm.. I think i misunderstood the route conceptually.
>
> What i thought was that below is a single route;
>
> from("sql:select rowid vrowid from myTable where nstatus = 0?outputClass=" +
> MyBean.class.getName()
> + "=update myTable set nstatus = 1 where rowid =
> :#${body.getVrowid()}")
>
> .routeId("mySimpleRoute").threads(5).to("direct:generateLine").end();
>
>
> and the exchange becomes complete when we do
>
> ...
> ...
> // piece of code above
> .to("direct:generateLine").end();
>
> and another route is
>
> from("direct:generateLine").process(new
> LineGenerator()).to("amq:queue:jms.simpleQueue");
>
> So i expected onConsume receives MyBean as the body of exchange;
> But you are saying that exhange is complete after this line
>
>>> from("direct:generateLine").process(new
>>> LineGenerator()).to("amq:queue:jms.simpleQueue");
>
> so onConsume receives whatever is set as the body of exchange in the
> instance of LineGenerator.
>
> I think i am confused?
>
> Could you please help me understand what makes up the route?
>
> Regards
> Önder
>
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/DefaultSqlPrepareStatementStrategy-lookupParameter-when-onConsume-used-in-SQL-component-tp5780437p5780663.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: DefaultSqlPrepareStatementStrategy lookupParameter when onConsume used in SQL component

2016-04-07 Thread onders
Hmm.. I think i misunderstood the route conceptually.

What i thought was that below is a single route;

from("sql:select rowid vrowid from myTable where nstatus = 0?outputClass=" +
MyBean.class.getName() 
+ "=update myTable set nstatus = 1 where rowid =
:#${body.getVrowid()}") 
   
.routeId("mySimpleRoute").threads(5).to("direct:generateLine").end(); 


and the exchange becomes complete when we do 

...
...
// piece of code above
.to("direct:generateLine").end();

and another route is 

from("direct:generateLine").process(new
LineGenerator()).to("amq:queue:jms.simpleQueue");

So i expected onConsume receives MyBean as the body of exchange;
But you are saying that exhange is complete after this line

>> from("direct:generateLine").process(new
>> LineGenerator()).to("amq:queue:jms.simpleQueue");

so onConsume receives whatever is set as the body of exchange in the
instance of LineGenerator.

I think i am confused?

Could you please help me understand what makes up the route?

Regards
Önder








--
View this message in context: 
http://camel.465427.n5.nabble.com/DefaultSqlPrepareStatementStrategy-lookupParameter-when-onConsume-used-in-SQL-component-tp5780437p5780663.html
Sent from the Camel - Users mailing list archive at Nabble.com.


JMS vs MQ message

2016-04-07 Thread blommis
I'm trying to receive a JMS message and send it to a MQ queue, keeping
headers on the message.
But headers are sent when using targetClient=1.

So when using the following, no headers are sent.
from("*wmq:queue:A0*").log("${headers}");
template.sendBodyAndHeader("*wmq:queue:A0*", "body", "h1", "headervalue");

However, when having a component called wmqJms (using wmq but without
targetClient=1), it does read headers, even if I have from wmq. But then
when forwarding the message to a wmq component (targetClient=1), there is no
headers on the A1 queue
from("*wmq:queue:A0*").log("${headers}").to("wmq:queue:A1");
template.sendBodyAndHeader("*wmqJms:queue:A0*", "body", "h1",
"headervalue");


public static Component createMQComponent(Properties properties) throws
JMSException {
JmsComponent jmsComponent = getJmsComponent(properties);
jmsComponent.setDestinationResolver(new DestinationResolver() {
@Override
public Destination resolveDestinationName(Session session,
String destinationName, boolean pubSubDomain) throws JMSException {
MQQueueSession mqSession = (MQQueueSession) session;
return session.createQueue("queue:///" + destinationName +
"?targetClient=1");
}
});
return jmsComponent;
}

private static JmsComponent getJmsComponent(Properties properties)
throws JMSException {
return MQComponentBuilder.mqComponent(
properties.getPropertyNotNull("wmq.hostname"),
   
Integer.parseInt(properties.getPropertyNotNull("wmq.port")),
properties.getPropertyNotNull("wmq.username"),
properties.getPropertyNotNull("wmq.password"),
properties.getPropertyNotNull("wmq.queueManager"),
properties.getPropertyNotNull("wmq.channel")
);
}



--
View this message in context: 
http://camel.465427.n5.nabble.com/JMS-vs-MQ-message-tp5780662.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: infinispan Idempotent and RemoteCacheManager

2016-04-07 Thread Scisci
Hi, to coplete the information set I sent,
this is the config of hotrod-client.properties

infinispan.client.hotrod.transport_factory =
org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory
infinispan.client.hotrod.server_list = 10.0.0.77:11222
infinispan.client.hotrod.marshaller =
org.infinispan.commons.marshall.jboss.GenericJBossMarshaller
infinispan.client.hotrod.async_executor_factory =
org.infinispan.client.hotrod.impl.async.DefaultAsyncExecutorFactory
infinispan.client.hotrod.default_executor_factory.pool_size = 1
infinispan.client.hotrod.default_executor_factory.queue_size = 1
infinispan.client.hotrod.hash_function_impl.1 =
org.infinispan.client.hotrod.impl.consistenthash.ConsistentHashV1
infinispan.client.hotrod.tcp_no_delay = true
infinispan.client.hotrod.ping_on_startup = true
infinispan.client.hotrod.request_balancing_strategy =
org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy
infinispan.client.hotrod.key_size_estimate = 64
infinispan.client.hotrod.value_size_estimate = 512
infinispan.client.hotrod.force_return_values = false

## below is connection pooling confi
maxActive=-1
maxTotal = -1
maxIdle = -1
whenExhaustedAction = 1
timeBetweenEvictionRunsMillis=12
minEvictableIdleTimeMillis=30
testWhileIdle = true
minIdle = 1

---
If I use only the remote cache manager bean it's work ( I've injected the
bean on a processor and the cache worked correctly on the two servers

when used in InfinispanIdempotentRepository didn't work

any help is appreciated
Thanks
Mirko




--
View this message in context: 
http://camel.465427.n5.nabble.com/infinispan-Idempotent-and-RemoteCacheManager-tp5780600p5780661.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: DefaultSqlPrepareStatementStrategy lookupParameter when onConsume used in SQL component

2016-04-07 Thread Claus Ibsen
Ah yeah that is intended. The onConsume runs after the exchange is
complete. So you need to store the id somewhere in a header or
something if you modify the message body.

.setHeader("rowId").simple("${body.vrow_id}")
.threads...

And then use the header in the onConsume



On Thu, Apr 7, 2016 at 9:46 AM, onders  wrote:
> no, this does not help :(
>
> when i debug, interestingly i can see onConsume gets exhange's body as the
> output of bean bound on from("direct:generateLine"...) route which is
> LineGenerator..
>
> from("sql:select rowid vrowid from myTable where nstatus = 0?outputClass=" +
> MyBean.class.getName()
> + "=update myTable set nstatus = 1 where rowid =
> :#${body.getVrowid()}")
>
> .routeId("mySimpleRoute").threads(5).to("direct:generateLine").end();
>
> from("direct:generateLine").process(new
> LineGenerator()).to("amq:queue:jms.simpleQueue");
>
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
> invoke method: getVrowid() on null due to:
> org.apache.camel.component.bean.MethodNotFoundException: Method with name:
> getVrowid() not found on bean: testField1|textField2|
>  of type: java.lang.String. Exchange[]
> at
> org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:321)
> at
> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114)
> at
> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:138)
> at
> org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:126)
> at
> org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:118)
> at
> org.apache.camel.builder.ExpressionBuilder$34.evaluate(ExpressionBuilder.java:852)
> at
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
> at
> org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy.lookupParameter(DefaultSqlPrepareStatementStrategy.java:200)
> at
> org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy$PopulateIterator.next(DefaultSqlPrepareStatementStrategy.java:267)
> at
> org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy.populateStatement(DefaultSqlPrepareStatementStrategy.java:129)
> at
> org.apache.camel.component.sql.DefaultSqlProcessingStrategy$1.doInPreparedStatement(DefaultSqlProcessingStrategy.java:52)
> at
> org.apache.camel.component.sql.DefaultSqlProcessingStrategy$1.doInPreparedStatement(DefaultSqlProcessingStrategy.java:46)
> at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:629)
> at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:658)
> at
> org.apache.camel.component.sql.DefaultSqlProcessingStrategy.commit(DefaultSqlProcessingStrategy.java:46)
> at
> org.apache.camel.component.sql.SqlConsumer.processBatch(SqlConsumer.java:240)
> at
> org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:137)
> at
> org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:110)
> at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:629)
> at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:658)
> at
> org.apache.camel.component.sql.SqlConsumer.poll(SqlConsumer.java:149)
> at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
> at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:744)
> Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method
> with name: getVrowid() not found on bean: testField1|textField2|
>  of type: java.lang.String. Exchange[]
> at
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:271)
> at
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:185)
> at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:159)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
> at
> 

Re: swagger injects empty headers in 2.17.0

2016-04-07 Thread Tim Dudgeon

On 07/04/2016 06:12, Claus Ibsen wrote:

Hi

Ah can you log that in the JIRA


Done: https://issues.apache.org/jira/browse/CAMEL-9828


Re: DefaultSqlPrepareStatementStrategy lookupParameter when onConsume used in SQL component

2016-04-07 Thread onders
no, this does not help :(

when i debug, interestingly i can see onConsume gets exhange's body as the
output of bean bound on from("direct:generateLine"...) route which is
LineGenerator..

from("sql:select rowid vrowid from myTable where nstatus = 0?outputClass=" +
MyBean.class.getName() 
+ "=update myTable set nstatus = 1 where rowid =
:#${body.getVrowid()}") 
   
.routeId("mySimpleRoute").threads(5).to("direct:generateLine").end(); 

from("direct:generateLine").process(new
LineGenerator()).to("amq:queue:jms.simpleQueue");

org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
invoke method: getVrowid() on null due to:
org.apache.camel.component.bean.MethodNotFoundException: Method with name:
getVrowid() not found on bean: testField1|textField2|
 of type: java.lang.String. Exchange[]
at
org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:321)
at
org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114)
at
org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:138)
at
org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:126)
at
org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:118)
at
org.apache.camel.builder.ExpressionBuilder$34.evaluate(ExpressionBuilder.java:852)
at
org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
at
org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy.lookupParameter(DefaultSqlPrepareStatementStrategy.java:200)
at
org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy$PopulateIterator.next(DefaultSqlPrepareStatementStrategy.java:267)
at
org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy.populateStatement(DefaultSqlPrepareStatementStrategy.java:129)
at
org.apache.camel.component.sql.DefaultSqlProcessingStrategy$1.doInPreparedStatement(DefaultSqlProcessingStrategy.java:52)
at
org.apache.camel.component.sql.DefaultSqlProcessingStrategy$1.doInPreparedStatement(DefaultSqlProcessingStrategy.java:46)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:629)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:658)
at
org.apache.camel.component.sql.DefaultSqlProcessingStrategy.commit(DefaultSqlProcessingStrategy.java:46)
at
org.apache.camel.component.sql.SqlConsumer.processBatch(SqlConsumer.java:240)
at
org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:137)
at
org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:110)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:629)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:658)
at
org.apache.camel.component.sql.SqlConsumer.poll(SqlConsumer.java:149)
at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method
with name: getVrowid() not found on bean: testField1|textField2|
 of type: java.lang.String. Exchange[]
at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:271)
at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:185)
at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:159)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:68)
at
org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:211)
at
org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:317)



--
View this message in context: 
http://camel.465427.n5.nabble.com/DefaultSqlPrepareStatementStrategy-lookupParameter-when-onConsume-used-in-SQL-component-tp5780437p5780645.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RabbitMQ Blocked Connections Notification

2016-04-07 Thread veersix
Hi,

Does the Camel RabbitMQ component handle blocked connection notifications
when publishing messages? I have been unable to find anything in the
documentation or in this list to say whether it does or does not.

This is what I'm talking about when i say blocked connection notifications:

https://www.rabbitmq.com/connection-blocked.html
  

Thanks,
Colin.



--
View this message in context: 
http://camel.465427.n5.nabble.com/RabbitMQ-Blocked-Connections-Notification-tp5780632.html
Sent from the Camel - Users mailing list archive at Nabble.com.