Re: URI contains unsafe characters

2016-04-12 Thread Marco Crivellaro
Any idea?
Thanks



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


Problem with the Body object of a Camel CXF endpoint where DataFormat = MESSAGE

2016-04-12 Thread Charles Moulliard
Hi,

When a Camel CXF endpoint (where the data format = MESSAGE) processes a
SOAP HTTP request, then the Body is defined as InputStream but without
BodyType

Message History
---
RouteId  ProcessorId  Processor
   Elapsed (ms)
[route3] [route3] [cxf://bean:cheeseServiceBean
 ] [ 7]
[route3] [bean1 ] [bean[ref:utils method:
convertToDom]  ] [ 2]

Exchange
---
Exchange[
Id  ID-dabou-local-58987-1460456138378-0-2
ExchangePattern InOut
Headers {accept-encoding=gzip,deflate,
breadcrumbId=ID-dabou-local-58987-1460456138378-0-1, ... ,
CamelHttpCharacterEncoding=UTF-8, CamelHttpMethod=POST, CamelHttpPath=,
CamelHttpUri=/camel/CheeseService, CamelRedelivered=false,
CamelRedeliveryCounter=0, connection=keep-alive,
Content-Type=text/xml;charset=UTF-8, Host=localhost:9001,
User-Agent=Apache-HttpClient/4.1.1 (java 1.5)}
BodyTypenull
Body[Body is instance of java.io.InputStream]
]

Surprisingly, I can't cast it to a stream as the object is of type
AbtrstractHTTPDestination

java.lang.ClassCastException:
org.apache.cxf.transport.http.AbstractHTTPDestination$1 cannot be cast to
java.io.ByteArrayInputStream

Is there a trick to resolve that ?

Regards,

Charles


Re: Email not copied to sent items

2016-04-12 Thread NewCamelDev
Thanks Walzer. While we are exploring the CC solution, I would like to check
with you would it be possible to extend the DeafultJavaMailSender, try to
open the imap store and copy it in "Sent Items".

Sounds possible but I couldnt find a way to configure the customized
JavaMailSender which extends the DeafultJavaMailSender. I see a
javaMailSender option available for us to specify the custom one but not
sure what exactly need to specify is it the fully qualified class to be
specified? If yes how does the camel instantiate it ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Email-not-copied-to-sent-items-tp5780744p5780936.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel not being able to start up if the RabbitMQ server using MQTT or STOMP is unavailable

2016-04-12 Thread nvbabu
ActiveMQ with camel  not being able to start up if the RabbitMQ server using
MQTT or STOMP is unavailable. The way I replicate this problem is to:
1. Configure camel.xml to use MQTT or STOMP to a remote broker
2. Stop the remote broker (RabbitMQ)
3. Restart ActiveMQ

Initially Camel starts but it then shuts down and also Active MQ after not
being able to connect to the remote rabbit MQ broker.

Environment details; 
Active MQ:5.10.0
Camel :2.17.0
Rabbit MQ :3.5.0

Please help us to solve this on priority.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-not-being-able-to-start-up-if-the-RabbitMQ-server-using-MQTT-or-STOMP-is-unavailable-tp5780946.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Guaranteed file processing - JMS and file producer

2016-04-12 Thread Quinn Stevenson
Is there a reason you’re not using a persistent aggregation repository?

If you could share a simplified version of your route, that would help as well.


> On Apr 11, 2016, at 4:21 AM, glenn  wrote:
> 
> Hi 
> 
> I’ve been looking at how to use camel-jms to consume xml from a persistent
> queue, do some minor transformation/validation of the xml and either output
> a single file or route a message to an error queue. 
> 
> The ultimate goal is to ensure that ALL messages are consumed and either a
> file is created ONCE or an error is routed ONCE to an error queue.
> 
> As not wishing to use XA transactions by default, I opted to try out an
> approach using local JMS transactions, the Camel file component producing
> the files and use of an idempotent repository to guard against the
> re-processing of redelivered, duplicate messages.
> 
> I’d appreciate views on whether it is the case that the approach of using
> the Camel file producer alongside native JMS transactions and an
> idempotentRepository cannot achieve the desired goal and that to achieve the
> goal must I opt to go down the XA route? 
> 
> My preference was a) not to have to add the additional complexity/overhead
> of global transactions unless absolutely necessary and b) to use the Camel
> file component as the file producer. 
> 
> Whilst I can see the original, native JMS transaction based approach working
> in part, when considering just the sunny day scenario of successful file
> production only the approach does not guarantee that files will only be
> produced ONCE. A JVM crash at an inopportune moment between the
> JmsTransactionManager transaction commit and file repository record
> insertion can lead to skipping file production (the risk of breaking this
> guarantee is niche but it does, nonetheless, seem to exist). 
> 
> My current  thinking is the way to achieve the goal is to use XA
> transactions alongside an XA compliant file producer and JTA  transaction
> manager. However, that does seem to preclude the use of the Camel file
> component (being non fully transactional – “best efforts” based). 
> 
> For record, I’m using the Camel File component as the file producer with
> local JMS transactions, an externally defined Spring transaction manager,
> use of the Camel  element within route and use of the
> FileIdempotentRepository. The FileIdempotentRepository filters out message
> duplicates based on the JmsMessageId (it is configured with eager=true,
> using false just shifts problem). 
> The log output below,  highlights the point where a JVM crash will lead to
> failure to produce a file but still consume the message.
> 
> 
> 05 Apr 2016 09:06:27   JmsTransactionManager  DEBUG Created JMS
> transaction on Session [Cached JMS Session: ActiveMQSession
> {id=ID:ANAME-ABCDEFGH-63012-1459843265976-1:1:1,started=false}
> java.lang.Object@44eb7aa] from Connection [Shared JMS Connection:
> ActiveMQConnection
> {id=ID:ANAME-ABCDEFGH-63012-1459843265976-1:1,clientId=ID:ANAME-ABCDEFGH-63012-1459843265976-0:1,started=false}]
> 05 Apr 2016 09:06:27   TransactionContext DEBUG
> Begin:TX:ID:ANAME-ABCDEFGH-63012-1459843265976-1:1:4
> 05 Apr 2016 09:06:27   ultJmsMessageListenerContainer DEBUG Received message
> of type [class org.apache.activemq.command.ActiveMQBytesMessage] from
> consumer [ActiveMQMessageConsumer {
> value=ID:ANAME-ABCDEFGH-63012-1459843265976-1:1:1:244, started=true }] of
> transactional session [Cached JMS Session: ActiveMQSession
> {id=ID:ANAME-ABCDEFGH-63012-1459843265976-1:1:1,started=true}
> java.lang.Object@44eb7aa]
> 05 Apr 2016 09:06:27   EndpointMessageListenerDEBUG
> Endpoint[inputQueue://ANAME.INV.RESP.Q] consumer received JMS message:
> ActiveMQBytesMessage ...
> 05 Apr 2016 09:06:27   TransactionErrorHandlerDEBUG Transaction
> begin (0x2e900519) redelivered(false) for (MessageId:
> ID:ANAME-ABCDEFGH-64219-1459497606992-9:1:1:1:30 on ExchangeId:
> ID-ANAME-ABCDEFGH-62996-1459843263591-0-22))
> 05 Apr 2016 09:06:27   JmsTransactionManager  DEBUG Participating in
> existing transaction
> 05 Apr 2016 09:06:27   TransactionErrorHandlerTRACE isRunAllowed()
> -> true (Run allowed if we are not stopped/stopping)
> ...
> 05 Apr 2016 09:06:27   routeUnderTest   INFO 
> ID:ANAME-ABCDEFGH-64219-1459497606992-9:1:1:1:30: Queue message:  version="1.0" encoding="UTF-8" standalone="yes"?>
> 05 Apr 2016 09:06:27   SendProcessor  DEBUG 
> Endpoint[AcknowledgementProcessor]
> Exchange[ID-ANAME-ABCDEFGH-62996-1459843263591-0-22][JmsMessage[JmsMessageID:
> ID:ANAME-ABCDEFGH-64219-1459497606992-9:1:1:1:30]]
> 05 Apr 2016 09:06:27   AcknowledgementProcessor   DEBUG Payload is ...
> 05 Apr 2016 09:06:27   AcknowledgementProcessor   DEBUG Body is ...
> 05 Apr 2016 09:06:27   routeUnderTest   INFO 
> queue_ANAME.INV.RESP.Q_ID_ANAME-ABCDEFGH-64219-1459497606992-9_1_1_1_30:
> Processed message: 
> 05 Apr 2016 09:06:27   DefaultStreamCachingStrategy

Throttling JMS Messages from Multiple Queues

2016-04-12 Thread raza_naqvi
Hi Guys,

I am very new to Camel and trying to design a solution which needs
throttling on transactions per second. We have a number of JMS queues(~25
Queues) which feed into the downstream system. This underlying system has a
limit on transactions per second. Going through the Camel documentation, i
could see that i can configure "maximumRequestsPerPeriod" for a route which
will throttle all my queues to a combined threshold. My question is around
the logic that Camel uses to throttle and does it treat all queues fairly.

Thanks,
Raza



--
View this message in context: 
http://camel.465427.n5.nabble.com/Throttling-JMS-Messages-from-Multiple-Queues-tp5780947.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel-spring-boot + @UseAdviceWith

2016-04-12 Thread Jeff Segal
All,

I'm currently creating a camel-spring-boot project and would like to add
some tests using @UseAdviceWith but am hitting a few issues. I couldn't
find an example that fit that use case exactly, so I've played around with
different things to no avail.

Specifically, I found that when I use @ContextConfiguration to specify my
main Spring app config, my use of
@BootstrapWith(CamelTestContextBootstrapper.class) is honored (i.e. I can
step through it in a debugger during startup) and I can see @UseAdviceWith
being used in CamelSpringTestContextLoader.handleCamelContextStartup().
However, when I @Autowire my CamelContext into my test class, Spring
startup fails because it can't find my CamelContext Spring bean (even when
I explicitly include a @Configuration that extends CamelConfiguration,
which explicitly creates a CamelContext @Bean). I need a reference to my
CamelContext so that I can start it once I'm done setting up my routeWith
advice.

One last thing: when I use @SpringApplicationConfiguration instead of
@ContextConfiguration, Spring is able to find the CamelContext bean but it
ignores my @BootstrapWith(CamelTestContextBootstrapper.class) &
@UseAdviceWith and thus just starts up the CamelContext automatically
rather than waiting for me to start it manually (after my routeWith
advice).

Any pointers on what I might be doing wrong would be great. In summary:

Honoring @UseAdviceWith but no CamelContext Spring bean:

@ContextConfiguration(classes = {ApplicationConfig.class})
@RunWith(CamelSpringJUnit4ClassRunner.class)
@BootstrapWith(CamelTestContextBootstrapper.class)
@UseAdviceWith
@Slf4j
public class MyTest {

@Autowired
CamelContext camelContext;

@Test
public void test() throws InterruptedException {
log.info("Starting test...");
Thread.sleep(1000 * 60);
}

}

Have a CamelContext Spring bean but NOT honoring @UseAdviceWith:

@SpringApplicationConfiguration(classes = {ApplicationConfig.class})
@RunWith(CamelSpringJUnit4ClassRunner.class)
@BootstrapWith(CamelTestContextBootstrapper.class)
@UseAdviceWith
@Slf4j
public class MyTest {

@Autowired
CamelContext camelContext;

@Test
public void test() throws InterruptedException {
log.info("Starting test...");
Thread.sleep(1000 * 60);
}

}

Thanks!
Jeff


database is locked

2016-04-12 Thread Anton
Hello

I am trying to use Camel JPA to store entities into a sqlite database.


My route looks like this:


public void configure() {

from(zendeskEndpoint).to("jpa:org.zendesk.client.v2.model.Ticket&persistenceUnit=camel");
}

However, I am getting the following error:

[l-1) thread #0 - zendesk://foo] ZendeskConsumerWARN  Error
processing exchange. Exchange[ID-Charles-38935-1460481217959-0-2]. Caused
by: [javax.persistence.PersistenceException -
org.hibernate.exception.GenericJDBCException: error performing isolated
work]
javax.persistence.PersistenceException:
org.hibernate.exception.GenericJDBCException: error performing isolated work
at
org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692)
at
org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)
at
org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1608)
at
org.hibernate.jpa.spi.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:1171)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344)
at com.sun.proxy.$Proxy71.merge(Unknown Source)
at org.apache.camel.component.jpa.JpaProducer$1.save(JpaProducer.java:116)
at
org.apache.camel.component.jpa.JpaProducer$1.doInTransaction(JpaProducer.java:89)
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.apache.camel.component.jpa.JpaProducer.process(JpaProducer.java:62)
at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)
at io.tradeworks.camel.zendesk.ZendeskConsumer.poll(ZendeskConsumer.java:44)
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:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.hibernate.exception.GenericJDBCException: error performing
isolated work
at
org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
at
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
at
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
at
org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:79)
at
org.hibernate.id.enhanced.TableGenerator$1.getNextValue(TableGenerator.java:530)
at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40)
at
org.hibernate.id.enhanced.TableGenerator.generate(TableGenerator.java:526)
at
org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:105)
at
org.hibernate.jpa.event.internal.core.JpaMergeEventListener.saveWithGeneratedId(JpaMergeEventListener.java:56)
at
org.hibernate.event.internal.DefaultMergeEventListener.saveTransientEntity(DefaultMergeEventListener.java:254)
at
org.hibernate.event.internal.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:234)
at
org.hibernate.event.internal.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:300)
at
org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:169)
at
org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:68)
at org.hibernate.internal

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

2016-04-12 Thread Walzer, Thomas
Quinn, 

Your blueprint works fine (the factory method should be named getContext but 
that was an easy one).
Spares me one additional CamelContext :-)

Cheers, Thomas.

-Ursprüngliche Nachricht-
Von: Quinn Stevenson [mailto:qu...@pronoia-solutions.com] 
Gesendet: Freitag, 08. April 2016 17:03
An: users@camel.apache.org
Betreff: Re: [Bug?] hl7dataformat hapicontext&parser not in camel-blueprint.xsd

Something like this should work


 










You probably noticed I cheated a little - I didn’t want to work through all the 
Blueprint stuff to initialize the HapiContext so I created a factory to do it 
for me :-) import ca.uhn.hl7v2.DefaultHapiContext; import 
ca.uhn.hl7v2.HapiContext; import ca.uhn.hl7v2.parser.ParserConfiguration;

public class HapiContextFactory {

public HapiContext createContext() {
HapiContext answer = new DefaultHapiContext();

ParserConfiguration pc = answer.getParserConfiguration();

pc.addForcedEncode("NK1-2-1");
pc.addForcedEncode("NK1-2-2");
pc.addForcedEncode("NK1-3-1");
pc.addForcedEncode("NK1-4-1");
pc.addForcedEncode("NK1-4-3");
pc.addForcedEncode("NK1-4-5");
pc.addForcedEncode("NK1-4-6");

pc.addForcedEncode("PID-21-1");
pc.addForcedEncode("PID-22-1");
pc.addForcedEncode("PID-23-1");
pc.addForcedEncode("PID-24-1");
pc.addForcedEncode("PID-25-1");
pc.addForcedEncode("PID-26-1");

return answer;
}
}
I didn’t run any of this, but it compiles/validates :-)

Hope that helps ...

> On Apr 8, 2016, at 7:50 AM, Walzer, Thomas  
> wrote:
> 
> HapiContext hapiContext = new DefaultHapiContext();
>   
>   ParserConfiguration pc = hapiContext.getParserConfiguration();
>   
>   pc.addForcedEncode("NK1-2-1");
>   pc.addForcedEncode("NK1-2-2");
>   pc.addForcedEncode("NK1-3-1");
>   pc.addForcedEncode("NK1-4-1");
>   pc.addForcedEncode("NK1-4-3");
>   pc.addForcedEncode("NK1-4-5");
>   pc.addForcedEncode("NK1-4-6");
>   
>   pc.addForcedEncode("PID-21-1");
>   pc.addForcedEncode("PID-22-1");
>   pc.addForcedEncode("PID-23-1");
>   pc.addForcedEncode("PID-24-1");
>   pc.addForcedEncode("PID-25-1");
>   pc.addForcedEncode("PID-26-1");



Camel Hbase

2016-04-12 Thread VinothKR
Hi Team,
I'm using Camel Hbase component to put data into remote hbase but data is
getting inserted with value as null.

*Route*:



001


54321





*Data stored in table*
 001  column=emp:empId, timestamp=1460498530077, value=

*Camel Hbase version*: 2.13.2

The exchange headers are,
{breadcrumbId=ID-PHX2MYMV32-50125-1460498560942-0-1, CamelHBaseValue=54321,
CamelHBaseOperation=CamelHBasePut, CamelHBaseRowId=001,
CamelHBaseMaxScanResults=100}

Qualifier, Row Id and Column Name are properly inserted while column value
is having a null value. Please help in resolving the issue.

Thanks,
Vinoth.



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