Re: How to display log messages when using camel-cdi insde payara micro

2019-12-16 Thread Claus Ibsen
Hi

Apache Camel uses slf4j-api for logging.

So I would try to find out how payara works with this logging
framework, and how to configure this.


On Mon, Dec 16, 2019 at 7:07 PM chege  wrote:
>
> Hi,
>
> I have created an camel-cdi application inside payara micro which starts
> okey but the logs aren't showing up.  What should I add for the logs to
> display properly.
>
>
> I have tried adding "commn-logging.properties" file with below content
> but still no results.
>
>
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
> #org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
>
>
> Thanks.
>


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


How to display log messages when using camel-cdi insde payara micro

2019-12-16 Thread chege

Hi,

I have created an camel-cdi application inside payara micro which starts
okey but the logs aren't showing up.  What should I add for the logs to
display properly.


I have tried adding "commn-logging.properties" file with below content
but still no results.


org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
#org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger


Thanks.



useOriginalMessage at parallelProcessing

2019-12-16 Thread Thomas.Thiele
Hi, 

I still fiddling around with deadletter handling. 
I got a zip. This is splitted. When there is an error an exception is thrown. 
Then error handler (and the route) shall write the original file to dead letter 
dir. 
This works when I comment out the parallelProcessing. 
With parallelProcessing it did not write the original file to dead letter dir, 
but the xml.   

To be honest: this is annoying. 

I simply what to write the original input file (a zip) into dead letter 
directory in any cases 
where an exception is thrown. 
Even after aggregating later. 

Simple as that. 

Regards Thomas



errorHandler(deadLetterChannel("direct:deadletter").useOriginalMessage());

from("direct:deadletter")
.to(String.format("file://%s", DEADDIRECTORY))

from(FILE_IN_URI).routeId(FILE_ROUTE_ID)
   .split(new ZipSplitter()).shareUnitOfWork()
  .streaming()
  .choice()
 .when(simple("${in.header.CamelFileName} ends with 'xml'"))
  
.split(xpath("/ImgSendFax/Document"))//.parallelProcessing().shareUnitOfWork()
  -> EXEPTION


sjms2 + OSGi ConnectionFactory

2019-12-16 Thread k.j.chernov
Hi!

On camel-3.0.0 + karaf 4.2.7 + artemis 2.10.1
JMS ConnectionFactory is registered as a service
(javax.jms.ConnectionFactory) without pooling and passed as a blueprint
proxy into the sjms2 component.

XML:

http://www.osgi.org/xmlns/blueprint/v1.0.0;>

http://camel.apache.org/schema/blueprint;>


Hello, world



 

And everything is fine, until the ConnectionFactory is unregistered and
registered again (due to configuration change, for example).
After that, following exception is thrown:
19:03:42.372 WARN [Camel (camel-47) thread #185 - timer://example] Error
processing exchange. Exchange[ID-KJCHERNOV-WIN-1576168069058-51-2]. Caused
by: [org.apache.camel.CamelExchangeException - Unable to complete sending
the JMS message. Exchange[ID-KJCHERNOV-WIN-1576168069058-51-2]. Caused by:
[javax.jms.IllegalStateException - Session is closed]]
org.apache.camel.CamelExchangeException: Unable to complete sending the JMS
message. Exchange[ID-KJCHERNOV-WIN-1576168069058-51-2]. Caused by:
[javax.jms.IllegalStateException - Session is closed]
at
org.apache.camel.component.sjms.producer.InOnlyProducer.sendMessage(InOnlyPr
oducer.java:53) ~[!/:3.0.0]
at
org.apache.camel.component.sjms.SjmsProducer.process(SjmsProducer.java:261)
~[!/:3.0.0]
at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:134)
~[!/:3.0.0]
at
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliverySta
te.run(RedeliveryErrorHandler.java:476) ~[!/:3.0.0]
at
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(Default
ReactiveExecutor.java:185) [!/:3.0.0]
at
org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultRea
ctiveExecutor.java:59) [!/:3.0.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:87)
[!/:3.0.0]
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProce
ssor.java:228) [!/:3.0.0]
at
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsum
er.java:193) [!/:3.0.0]
at
org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:75)
[!/:3.0.0]
at java.util.TimerThread.mainLoop(Timer.java:556) [?:?]
at java.util.TimerThread.run(Timer.java:506) [?:?]
Caused by: javax.jms.IllegalStateException: Session is closed
at
org.apache.activemq.artemis.jms.client.ActiveMQSession.checkClosed(ActiveMQS
ession.java:1251) ~[!/:?]
at
org.apache.activemq.artemis.jms.client.ActiveMQSession.createTextMessage(Act
iveMQSession.java:233) ~[!/:?]
at
org.apache.camel.component.sjms.jms.JmsBinding.createJmsMessageForType(JmsBi
nding.java:530) ~[!/:3.0.0]
at
org.apache.camel.component.sjms.jms.JmsBinding.createJmsMessage(JmsBinding.j
ava:470) ~[!/:3.0.0]
at
org.apache.camel.component.sjms.jms.JmsBinding.makeJmsMessage(JmsBinding.jav
a:285) ~[!/:3.0.0]
at
org.apache.camel.component.sjms.jms.JmsBinding.makeJmsMessage(JmsBinding.jav
a:226) ~[!/:3.0.0]
at
org.apache.camel.component.sjms.producer.InOnlyProducer.sendMessage(InOnlyPr
oducer.java:50) ~[!/:3.0.0]
... 11 more

And it will never recover until restart of a bundle, as it caches the
Session object.

Is there anything I can do about it?

P.S.> camel-jms does not handle this either, though it's complaining about
closed service locator, which was probably garbage collected.

Thanks in advance,
Konstantin J. Chernov.



AW: Aggregation and unitOfWork

2019-12-16 Thread Thomas.Thiele
Hi, 

I tried to. But the messages I get in aggregate(old, new) or different and 
don’t have the information anymore.
And the aggregate-method with three params is never called. 

@Override
  public Exchange aggregate(Exchange oldExchange, Exchange newExchange, 
Exchange inputExchange) {
return aggregate(oldExchange, newExchange);
  }

Or I put the original message to message header?

Thomas


-Ursprüngliche Nachricht-
Von: Claus Ibsen  
Gesendet: Montag, 16. Dezember 2019 06:35
An: users@camel.apache.org
Betreff: Re: Aggregation and unitOfWork

Hi

The output of the aggregate is not tied to any of its input, its a separate new 
exchange, so they dont' share any unit of work etc.
So the data you want as output from the aggregator, you must then add via the 
aggregation strategy

On Thu, Dec 12, 2019 at 2:56 PM  wrote:
>
> Hi,
>
> Aggration seems to lost the connection to original Message.
>
> I have the following construct:
>
> from(FILE_IN_URI)
>   .split(new ZipSplitter()).shareUnitOfWork()
>   .streaming()
>   .choice()
>.when(simple("${in.header.CamelFileName} ends with 'xml'"))
>.process(exchange -> {
>   System.out.println("debug exchange"); -> throw 
> EXCEPTION 1
> })
>.to(EP_AGGREGATION)
>.endChoice()
>   .otherwise()
>   .to(FILE_OUT_URI)
>.process(exchange -> {
>   System.out.println("debug exchange");-> throw 
> EXCEPTION 2
> })
>   .to(EP_AGGREGATION)
>   .endChoice()
>   .end()
>.end()
> ;
>
> from(EP_AGGREGATION_)
>.aggregate(header("foo"), new ThomasAggregationStrategy())
> .completionTimeout(10 * 1000)
> .completion(header("bar").isEqualTo(true))
> .process(exchange -> {
>  System.out.println("debug exchange");
> })
> .throwException(IllegalArgumentException.class, "Thomas 
> DEBUG") -> throw EXCEPTION 3 ;
>
> A route with splitter and an aggregation route.
> Before the last "to" at the end I add a process with println to set a 
> breakpoint and debug the exchange.
>
> What happens is, when an exception is thrown in the splitter route, e.g. 
> instead of the debug println.
> (EXCEPTION 1 and 2) the deadletter route works.
> But when an exception is thrown after aggregation the infos are gone.
> I noticed that the exchange at the end, before .to(EP_AGGREGATION) is 
> different from the exchange the
> ThomasAggregationStrategy:: aggregate() sees. I see unitOfWork is gone.
>
> errorHandler(deadLetterChannel("direct:deadletter").useOriginalMessage());
> from("direct:deadletter")
> // save original message
>
>
>


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