You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Imran Raza Khan <im...@gmail.com> on 2019/11/04 16:30:03 UTC

pollEnrich with header property from previous exchange

I want to listen on ActiveMQ topic based on the hostname of system and some
other logic, So i planned to use pollEnrich for it so i evaluate my logic
and provide topic name in pollEnrich but as per document

*pollEnrich or enrich does not access any data from the current Exchange
which means when polling it cannot use any of the existing headers you may
have set on the Exchange. For example you cannot set a filename in the
Exchange.FILE_NAME header and use pollEnrich to consume only that file. For
that you must set the filename in the endpoint URI.*

How i can figure out this

    from("timer://ipc?repeatCount=1")
    .. some logic..
    .setHeader("topic_no",simple("{{env:HOSTNAME}}"))
    .pollEnrich("mqtt:foo?host=tcp://0.0.0.0:1883
&subscribeTopicNames=${header.topic_no}/status&clientId=ipc")
    .to("log:my?showAll=true&multiline=true");

Please dont suggest to use hostname directly in URI, As i highlighted i
have to compute other logic too, What other option or way i can use?

AW: pollEnrich with header property from previous exchange

Posted by Da...@dz-privatbank.com.
Hi,


is it possible for you to determine the topic/hostname and so on outside the camelcontext for example in a static method?

That way you could provide camel with the complete url and thus you don't have to use an exchange header.


regards daniel

________________________________
Von: Imran Raza Khan <im...@gmail.com>
Gesendet: Montag, 04. November 2019 17:30:03
An: users@camel.apache.org
Betreff: pollEnrich with header property from previous exchange

I want to listen on ActiveMQ topic based on the hostname of system and some
other logic, So i planned to use pollEnrich for it so i evaluate my logic
and provide topic name in pollEnrich but as per document

*pollEnrich or enrich does not access any data from the current Exchange
which means when polling it cannot use any of the existing headers you may
have set on the Exchange. For example you cannot set a filename in the
Exchange.FILE_NAME header and use pollEnrich to consume only that file. For
that you must set the filename in the endpoint URI.*

How i can figure out this

    from("timer://ipc?repeatCount=1")
    .. some logic..
    .setHeader("topic_no",simple("{{env:HOSTNAME}}"))
    .pollEnrich("mqtt:foo?host=tcp://0.0.0.0:1883
&subscribeTopicNames=${header.topic_no}/status&clientId=ipc")
    .to("log:my?showAll=true&multiline=true");

Please dont suggest to use hostname directly in URI, As i highlighted i
have to compute other logic too, What other option or way i can use?

**********************************************************************
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, please call or e-mail the sender and delete the message and any attachment from your system. If you are not the intended recipient, you must not copy this message or attachment or disclose the contents to any other person. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive later or incomplete, or contain viruses. DZ PRIVATBANK therefore does not accept liability for any errors or omissions in the contents of this message which arises as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes only and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. DZ PRIVATBANK does not warrant that incoming e-mails will be processed within a certain period of time. For security reasons, DZ PRIVATBANK does not accept any instructions that must be in writing (financial transactions, changes of address, etc.) sent by e-mail. If a message is urgent, please contact us by telephone.
**********************************************************************