Cancelling messages

2016-12-21 Thread Glenn Puckett
My user has a UI that shows all messages that have been processed by or are
currently being processed by the Camel API.  During the time a message is in
process they want to be able to cancel the message.  In the application I
have code in a rest service that is called by the UI.  It contains:


public void cancelExchange(String exchangeId) {
synchronized (this.camelContext) {
// Get a list of all in flight exchanges with the passed in
exchangeId
final List exchanges =
this.camelContext.getInflightRepository().browse().stream().filter(inflightExchange
-> inflightExchange.getExchange().getExchangeId().equals(exchangeId))
   
.map(InflightRepository.InflightExchange::getExchange).collect(Collectors.toList());

// Remove any active exchanges from Camel
for (final Exchange exchange : exchanges) {
this.log.debug("Removing exchange {}",
exchange.getExchangeId());

this.camelContext.getInflightRepository().remove(exchange);

// Set the ROUTE_STOP property so Camel will try to stop the
Exchange on the next
// retry
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
}
}

This is not working.  I identified an endpoint that is refusing connections. 
It goes through the re-delivery tries and eventually fails.  What do I need
to do to tell Camel to drop that message?



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


Re: QuartzScheduledPollConsumerScheduler, cluster and scheduler.triggerId

2016-11-02 Thread glenn
The FileIdempotentRepositoryReadLockStrategy.acquireExclusiveReadLock method
guards against processing the same file twice.
So specification of the scheduler.triggerId is NOT required to ensure that
the file is only processed once in the cluster



--
View this message in context: 
http://camel.465427.n5.nabble.com/QuartzScheduledPollConsumerScheduler-cluster-and-scheduler-triggerId-tp5789575p5789639.html
Sent from the Camel - Users mailing list archive at Nabble.com.


QuartzScheduledPollConsumerScheduler, cluster and scheduler.triggerId

2016-11-01 Thread glenn
Am using a camel file consumer within a cluster to poll files on a periodic
basis. I wish to ensure that a consumer will only poll files if it has an
exclusive read lock on them so using the
QuartzScheduledPollConsumerScheduler with a readLock=idempotent read lock
strategy backed by a JdbcMessageIdRepository idempotentRepository.

I wanted to confirm that such an approach will ONLY work correctly in
cluster PROVIDED a unique triggerId is also assigned (ie assigned via use of
the QuartzScheduledPollConsumerScheduler scheduler.triggerId option)?

As where scheduler.triggerId is NOT assigned then a UUID is generated and a
unique job/trigger is created for EACH node resulting in > 1 file consumers
poll starting simultaneously.
For example in a cluster of two nodes with auto assigned UUID triggerId,
then two jobs will trigger against only one node each or both jobs against
one node. That scenario seems wrong in a cluster. 

BUT if a unique scheduler.triggerId is specified then only one job/trigger
will exist in DB and so quartz can ensure that the triggered job will only
ever work against one of the nodes at a time. That does seem to be the
desired behaviour.

So adopting the use of a scheduler.triggerId based approach does seem valid
but it does raise a question concerning the removal of the DB triggers/jobs
upon camel context shut down in a cluster so I wanted to check my
understanding before following up on that.




--
View this message in context: 
http://camel.465427.n5.nabble.com/QuartzScheduledPollConsumerScheduler-cluster-and-scheduler-triggerId-tp5789575.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Guaranteed file processing - JMS and file producer

2016-04-13 Thread glenn
Hi

I'm supplying a simplified route to assist. I didn't consider using the
persistent aggregation strategy here in that a single message is being
transformed into a single file - I hope that's clearer now with the example
route. The FileIdempotentRepository provides sufficient persistence needed
per my understanding.

The file component uri being used is actually to be determined but once the
files are placed in output folders there will be an external process to move
them. 
Without the idempotent repository and assuming the file name itself could be
idempotent I did consider allowing for the existing file to be updated but I
opted against this on basis that I cannot control when the subsequent
write/update will happen - it's possible the original file has already been
moved before the update. 
So have opted to prefer never to write the file twice (effectively removing
risk of duplicate response to an external system) and trade this off against
current risk that may not write any response.
In either scenario, as is, there would have to be mitigation to address and
it seems easier to detect and handle the latter, missed response scenario. 

I totally appreciate the probability of this is remote but I'm conscious
that I may be missing a simpler solution that would guarantee one file
output for every one message consumed that is based on use of the Camel file
component with local JMS transactions. That would avoiding any need to
implement mitigation measures or need to switch to use an XA file producer
that supports global transactions.










...





JmsMessageID


CamelDuplicateMessage
















 


Regards



--
View this message in context: 
http://camel.465427.n5.nabble.com/Guaranteed-file-processing-JMS-and-file-producer-tp5780899p5781004.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Guaranteed file processing - JMS and file producer

2016-04-11 Thread glenn
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: 
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   DEBUG Should spool
cache 1023 -> false
...
05 Apr 2016 09:06:27   routeUnderTest   INFO 
queue_ANAME.INV.RESP.Q_ID_ANAME-ABCDEFGH-64219-1459497606992-9_1_1_1_30:
Validated message: 
05 Apr 2016 09:06:27   FileIdempotentRepository   DEBUG Appending
ID:ANAME-ABCDEFGH-64219-1459497606992-9:1:1:1:30 to idempotent filestore:
C:\Files\filestore\filesOut\.filestore.dat

*** If JVM CRASH occurs here BEFORE JmsTra

RE: Re: Thoughts about Karaf profiles / releases / growing number of dependencies (Re: AW: AW: Problem when starting camel-cxf in karaf)

2011-05-17 Thread Glenn Silverman
Yeah! I got camel-cxf 2.8.0-SNAPSHOT working in Karaf 2.2.1 using the 
jre.property changes you described. It seems my earlier attempt used the 
jre.properties file in ServiceMix 4.3.0, which is different. 

Thanks for this help and I apologize for my previous mistake.

But this issue does bring up a sticky problem with OSGi, which is supposed to 
alleviate dependency "hell", as one of its main selling points. I haven't found 
this to be very true.



Glenn Silverman
Senior Java Developer
Office: 657-622-2900 x404


-Original Message-----
From: Glenn Silverman [mailto:gsilver...@dispensingsolutionsinc.com] 
Sent: Tuesday, May 17, 2011 10:30 AM
To: users@camel.apache.org; us...@cxf.apache.org
Subject: RE: Re: Thoughts about Karaf profiles / releases / growing number of 
dependencies (Re: AW: AW: Problem when starting camel-cxf in karaf)

I followed the instructions for modifying etc/jre.properties (actually, the 
file already comments out all the lines listed below) - adding the two xerces 
lines at the end, and tried features:install camel-cxf after installing war and 
camel from the features list, and I got the following error:

Error executing command: Could not start bundle 
mvn:org.apache.camel/camel-cxf/2.8-SNAPSHOT in feature(s) camel-cxf-2.8-
SNAPSHOT: The bundle "org.apache.camel.camel-cxf_2.8.0.SNAPSHOT [274]" could 
not be resolved. Reason: Missing Constraint
: Import-Package: org.apache.camel; version="[2.8.0,2.9.0)"

It seems Karaf is looking for 2.8.0 releases, not the shapshot version.



Glenn Silverman
Senior Java Developer
Office: 657-622-2900 x404


-Original Message-
From: Jean-Baptiste Onofré [mailto:j...@nanthrax.net] 
Sent: Tuesday, May 17, 2011 5:12 AM
To: us...@cxf.apache.org; users@camel.apache.org
Subject: Fwd: Re: Thoughts about Karaf profiles / releases / growing number of 
dependencies (Re: AW: AW: Problem when starting camel-cxf in karaf)

I forward my answer to CXF and Camel users mailing list as it could help 
other people.

Regards
JB

 Original Message 
Subject: Re: Thoughts about Karaf profiles / releases / growing number 
of dependencies (Re: AW: AW: Problem when starting camel-cxf in karaf)
Date: Tue, 17 May 2011 14:06:51 +0200
From: Jean-Baptiste Onofré 
Reply-To: d...@karaf.apache.org
To: d...@karaf.apache.org

OK guys I got it.

Here's the workaround:

- I took Karaf 2.2.1 from scratch and uncompress
- I changed the etc/jre.properties, in the jre-1.6 section, by:
  * commenting the following lines:

  # javax.activation, \
  [...]
  # javax.annotation, \
  # javax.annotation.processing, \
  [...]
  # javax.jws, \
  # javax.jws.soap, \
  [...]
  #javax.xml.bind, \
  #javax.xml.bind.annotation, \
  #javax.xml.bind.annotation.adapters, \
  #javax.xml.bind.attachment, \
  #javax.xml.bind.helpers, \
  #javax.xml.bind.util, \
  [...]
  #javax.xml.soap, \
  #javax.xml.stream, \
  #javax.xml.stream.events, \
  #javax.xml.stream.util, \
  [...]
  #javax.xml.ws, \
  #javax.xml.ws.handler, \
  #javax.xml.ws.handler.soap, \
  #javax.xml.ws.http, \
  #javax.xml.ws.soap, \
  #javax.xml.ws.spi, \
  #javax.xml.ws.wsaddressing, \
  [...]

  * adding the following lines at the end:

  com.sun.org.apache.xerces.internal.dom, \
  com.sun.org.apache.xerces.internal.jaxp

- After the added the camel features descriptor URL
- And installed the camel-cxf feature without problem

Regards
JB

On 05/17/2011 12:53 PM, akuhtz wrote:
> Hi JB,
>
> I've the same problem:
>   * Start with fresh karaf-2.2.1 (extracted from assembly.zip),
>   * add the camel features url in the console: features:addurl
> mvn:org.apache.camel.karaf/apache-camel/2.8-SNAPSHOT/xml/features
>   * try to install camel-cxf feature: features:install camel-cxf
>
> After a while the following is printed in the console:
> Error executing command: Could not start bundle
> mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saaj-imp
> l/1.3.2_1 in feature(s) camel-cxf-2.8-SNAPSHOT: Unresolved constraint in
> bundle org.apache.servicemix.bundles.saaj-impl
> [105]: Unable to resolve 105.0: missing requirement [105.0] package;
> (package=com.sun.org.apache.xerces.internal.dom)
>
> My env:
> java version "1.6.0_23"
> Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
> Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)
>
> Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
> Java version: 1.6.0_23
> Java home: C:\Siemens\Java\jdk1.6.0_23\jre
> Default locale: de_CH, platform encoding: Cp1252
> OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
>
> Regards
> Andi
>
>
> --
> View this message in context: 
> http://karaf.922171.n3.nabble.com/Thoughts-about-Karaf-profiles-releases-growing-number-of-dependencies-Re-AW-AW-Problem-when-starting-tp2419227p2951998.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.


RE: Re: Thoughts about Karaf profiles / releases / growing number of dependencies (Re: AW: AW: Problem when starting camel-cxf in karaf)

2011-05-17 Thread Glenn Silverman
I followed the instructions for modifying etc/jre.properties (actually, the 
file already comments out all the lines listed below) - adding the two xerces 
lines at the end, and tried features:install camel-cxf after installing war and 
camel from the features list, and I got the following error:

Error executing command: Could not start bundle 
mvn:org.apache.camel/camel-cxf/2.8-SNAPSHOT in feature(s) camel-cxf-2.8-
SNAPSHOT: The bundle "org.apache.camel.camel-cxf_2.8.0.SNAPSHOT [274]" could 
not be resolved. Reason: Missing Constraint
: Import-Package: org.apache.camel; version="[2.8.0,2.9.0)"

It seems Karaf is looking for 2.8.0 releases, not the shapshot version.



Glenn Silverman
Senior Java Developer
Office: 657-622-2900 x404


-Original Message-
From: Jean-Baptiste Onofré [mailto:j...@nanthrax.net] 
Sent: Tuesday, May 17, 2011 5:12 AM
To: us...@cxf.apache.org; users@camel.apache.org
Subject: Fwd: Re: Thoughts about Karaf profiles / releases / growing number of 
dependencies (Re: AW: AW: Problem when starting camel-cxf in karaf)

I forward my answer to CXF and Camel users mailing list as it could help 
other people.

Regards
JB

 Original Message 
Subject: Re: Thoughts about Karaf profiles / releases / growing number 
of dependencies (Re: AW: AW: Problem when starting camel-cxf in karaf)
Date: Tue, 17 May 2011 14:06:51 +0200
From: Jean-Baptiste Onofré 
Reply-To: d...@karaf.apache.org
To: d...@karaf.apache.org

OK guys I got it.

Here's the workaround:

- I took Karaf 2.2.1 from scratch and uncompress
- I changed the etc/jre.properties, in the jre-1.6 section, by:
  * commenting the following lines:

  # javax.activation, \
  [...]
  # javax.annotation, \
  # javax.annotation.processing, \
  [...]
  # javax.jws, \
  # javax.jws.soap, \
  [...]
  #javax.xml.bind, \
  #javax.xml.bind.annotation, \
  #javax.xml.bind.annotation.adapters, \
  #javax.xml.bind.attachment, \
  #javax.xml.bind.helpers, \
  #javax.xml.bind.util, \
  [...]
  #javax.xml.soap, \
  #javax.xml.stream, \
  #javax.xml.stream.events, \
  #javax.xml.stream.util, \
  [...]
  #javax.xml.ws, \
  #javax.xml.ws.handler, \
  #javax.xml.ws.handler.soap, \
  #javax.xml.ws.http, \
  #javax.xml.ws.soap, \
  #javax.xml.ws.spi, \
  #javax.xml.ws.wsaddressing, \
  [...]

  * adding the following lines at the end:

  com.sun.org.apache.xerces.internal.dom, \
  com.sun.org.apache.xerces.internal.jaxp

- After the added the camel features descriptor URL
- And installed the camel-cxf feature without problem

Regards
JB

On 05/17/2011 12:53 PM, akuhtz wrote:
> Hi JB,
>
> I've the same problem:
>   * Start with fresh karaf-2.2.1 (extracted from assembly.zip),
>   * add the camel features url in the console: features:addurl
> mvn:org.apache.camel.karaf/apache-camel/2.8-SNAPSHOT/xml/features
>   * try to install camel-cxf feature: features:install camel-cxf
>
> After a while the following is printed in the console:
> Error executing command: Could not start bundle
> mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saaj-imp
> l/1.3.2_1 in feature(s) camel-cxf-2.8-SNAPSHOT: Unresolved constraint in
> bundle org.apache.servicemix.bundles.saaj-impl
> [105]: Unable to resolve 105.0: missing requirement [105.0] package;
> (package=com.sun.org.apache.xerces.internal.dom)
>
> My env:
> java version "1.6.0_23"
> Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
> Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)
>
> Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
> Java version: 1.6.0_23
> Java home: C:\Siemens\Java\jdk1.6.0_23\jre
> Default locale: de_CH, platform encoding: Cp1252
> OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
>
> Regards
> Andi
>
>
> --
> View this message in context: 
> http://karaf.922171.n3.nabble.com/Thoughts-about-Karaf-profiles-releases-growing-number-of-dependencies-Re-AW-AW-Problem-when-starting-tp2419227p2951998.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.


Camel and spring XML

2009-03-06 Thread Glenn Macgregor
Hi All,

I have installed activemq 5.2.0 and see that a minimal set of camel 
functionality is included, activemq-camel.jar, camel-core, camel-jetty, 
camel-jms and camel-spring. I have added a route in my activemq.xml config file:


 
 


This route works fine, I get the message in the el1 topic listener and the 
test1 topic listener.

When I add a filter to the route:


 
 
 header.testto = "test1"
  



I do not get the message in the test1 topic listener.

Is this EIP included in the default camel jars in activemq or do I need to 
install the camel disto?

Also is there a way to set the uri attribute of the from and to elements using 
JMS message variables like header.testto?

Thanks

 Glenn



RE: Fuse Packages

2009-02-04 Thread Glenn Macgregor
Great, thanks.

Now the question is how do I tell the fuse message-broker installation that 
fuse mediation-router has been installed?

How can I add mediation-router specific xml into the message-broker config?

Glenn

-Original Message-
From: Adrian Trenaman [mailto:trena...@progress.com]
Sent: 04 February 2009 16:33
To: users@camel.apache.org
Subject: Re: Fuse Packages

HI Glenn,

I think the fusesource.com forum is back up; I believe there was some
problems earlier on but their fixed now.

FUSE Message Broker does implicitly contain parts of the FUSE
distribution of Camel - if you look in the lib/ directory you'll see
that camel-jms and camel-spring jars are present, for version 1.4.1.0-
fuse. So, if you're just doing JMS work in your camel routes then you
don't need to install FUSE mediation router. If however you're using
other Camel components (file, jetty, http, etc.) you should consider
downloading the FUSE Mediation Router installer separately.

Best,
Ade.

On 4 Feb 2009, at 16:15, Glenn Macgregor wrote:

> Hi All,
>
> I know this is not the correct place for this post but the
> fusesource forum page is broken so I cannot create an account.
>
> I have installed fuse-message-broker and it seems to incorporate
> camel already although it is a different version than the latest
> fuse-mediation-router. If this is true why do I need to install fuse-
> mediation-router, what else does it provide? Is there a way to
> integrate mediation-router into message-broker so I am using the
> latest mediation-router?
>
> Just trying to get a handle on what the components are and how to
> use them.
>
> Thanks
>
> Glenn

---
Adrian Trenaman, Consultant Fellow, PS - Opensource Center of Competence
Progress Software Corp
Shelbourne Road, Dublin 4, Ireland
---
+353-1-637-2659 (Office)
+353-1-637-2882 (Fax)
+353-86-6051026 (Mobile)
  adrian.trenaman (Skype)

Blog: http://trenaman.blogspot.com










Fuse Packages

2009-02-04 Thread Glenn Macgregor
Hi All,

I know this is not the correct place for this post but the fusesource forum 
page is broken so I cannot create an account.

I have installed fuse-message-broker and it seems to incorporate camel already 
although it is a different version than the latest fuse-mediation-router. If 
this is true why do I need to install fuse-mediation-router, what else does it 
provide? Is there a way to integrate mediation-router into message-broker so I 
am using the latest mediation-router?

Just trying to get a handle on what the components are and how to use them.

Thanks

 Glenn


Strange question

2009-02-04 Thread Glenn Macgregor
Hi All,

Starting to think about activemq and camel in a test situation, an instant 
messaging server.

ActiveMQ is the bus and camel handles the routing of the messages, let's say 
the messages are xml with a header which contains, among other things, a to 
attribute.

Design:

* One queue which all clients connect for sending

* Queue per client for client receiving

* Camel receives messages on the sending queue and routes them to the 
appropriate receiving queue

Does this design make sense and do you think it is scalable to 10's or 100's of 
thousands of concurrent clients?

Thanks

 Glenn