camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From balavino <>
Subject Camel - Binding a bean method with paramete of camel exchange
Date Thu, 25 Jun 2015 13:58:41 GMT

I need to bind and call a bean method with some parameters - 1: a string 2:
a exchange. I see from camel page #
that exchange binding as parameter is possible.
I'm using bean expression to do it.

In the code, i need to know the correct way of using (in the bolded line).
I'm here trying to set the throttle value of a camel route via some logic i
have to build in the binding method call.

/configure() method of a camel processor

    public final void configure() throws Exception {
        System.out.println("Exchange from Processor: " + e);
        String queueName = toUri.split(":")[2];      
        String throttleValue =
        .setHeader("HostId", simple(hostName))
        .process(new MessageProcessor())
        .log("Started Polling the Source Directory for Files.")

Method that i need to bind

ublic class QueueSizeCounter  {

    private ActiveMQComponent activemqComponent;
    private Session session;

    public Long getQueueSize(String queueName, Exchange e) throws
JMSException {
        activemqComponent = (ActiveMQComponent) e.getContext()
        Connection connection1 =
        session = connection1.createSession(false,
        Queue replyTo = session.createTemporaryQueue();
        MessageConsumer consumer = session.createConsumer(replyTo);
        Queue query = session.createQueue("ActiveMQ.Statistics.Destination"
+ queueName );
        MessageProducer producer = session.createProducer(query);
        Message msg = session.createMessage();
        MapMessage reply = (MapMessage) consumer.receive();
        for (Enumeration en = reply.getMapNames();en.hasMoreElements();) {
            String name = en.nextElement().toString();
            System.out.println(name + "=" + reply.getObject(name));
            return 1L;

View this message in context:
Sent from the Camel Development mailing list archive at

View raw message