Posts from Java

Stop and Start All Camel Routes

Java camel, jmx

Here is a quick example of how you might stop all Camel routes regardless of the CamelContext. I assume that you have prior knowledge of how to connect via JMX, or you can see my last post on Purging ActiveMQ Queues via JMX.

Purge ActiveMQ Queues

Java activemq, jxm, karaf

Whether for testing or some edge case sometimes you just need to clear out messages that have been building up. Here is an example of how you can clean all of a brokers queues using facilities exposed by JMX in ActiveMQ.

Groovy's Inject

Java groovy, functional

When I started getting into functional programming I relaized that Groovy has some features which could be considered functional or higher-order functions. I commonly use methods like findAll (filter) and collect (map). As I was reading Beginning Scala by David Pollack I came across fold which I had never used before. Groovy calls this inject. inject allows us to walk though a data structure calling a function on each node, the result of that function is then passed to the same function being called on the next node.