Ah, I just looked at the code, and it doesn't grab any user headers.  The
closest thing to user properties or headers that I can find is a field in
the PulsarMessageHeaders class:
@Metadata(label = "producer", description = "The properties of the message
to add.", javaType = "Map<String, String>")
String PROPERTIES_OUT = "CamelPulsarProducerMessageProperties";

Am I missing something?


On Fri, Apr 14, 2023 at 4:52 PM Steve973 <steve...@gmail.com> wrote:

> Claus,
>
> I switched to using .withHeader() calls instead of .withProperty(), but I
> am still not seeing my headers when I read the message from Pulsar.  How
> does the Pulsar component attempt to keep track of the headers?
>
>
> On Fri, Apr 14, 2023 at 10:47 AM Steve973 <steve...@gmail.com> wrote:
>
>> Claus,
>>
>> Thanks for that.  I suppose I was a bit confused about the difference.
>> In 2012, you said (on SO):
>>
>>> One distinction not mentioned by Ben and Petter is that properties are
>>> safely stored for the entire duration of the processing of the message in
>>> Camel. In contrast, headers are part of the message protocol, and may not
>>> be propagated during routing. For example, JMS has limitations on what
>>> you can store as headers etc.
>>
>>
>> On the same thread, I see Petter Nordlander claim:
>>
>>> Properties and headers are pretty much the same. Headers are, however,
>>> converted to/from protocol specific headers on certain components, such as
>>> Jms. So,
>>>
>>>    - Meta data inside a route: properties
>>>    - Meta data to/from outside: headers
>>>
>>>
>> Is this distinction because what happens with pulsar is technically
>> "outside" of the Exchange itself?  So the specific protocols handle just
>> what is supplied in the body and headers? And the headers have to get
>> mapped to something in the specific protocols that are used, and then they
>> will get mapped back into the message when read again by Camel when
>> consuming from that protocol?
>>
>> Hopefully I'm not even more confused now! 😂
>>
>> On Fri, Apr 14, 2023 at 5:03 AM Claus Ibsen <claus.ib...@gmail.com>
>> wrote:
>>
>>> Hi
>>>
>>> This is expected, exchange properties are local only to the current
>>> Exchange.
>>> If you send data over network protocols like pulsar, kafka, jms then
>>> the payload is only from the message (eg body and headers)
>>>
>>>
>>>
>>> On Thu, Apr 13, 2023 at 11:24 PM Steve973 <steve...@gmail.com> wrote:
>>>
>>> > Hello.  I am sending an exchange with a FluentProducerTemplate to a
>>> pulsar
>>> > endpoint.  When a route reads from that endpoint, the exchange property
>>> > that I set is no longer there.  This is how I am sending the message:
>>> >
>>> > Exchange exchange = ExchangeBuilder.anExchange(camelContext)
>>> > .withProperty("command", MessageTypes.GENERATE_NUMBERS_COMMAND)
>>> > .withBody(generateNumbersCommandMessage.toByteArray())
>>> > .build();
>>> > fluentProducerTemplate.withExchange(exchange)
>>> > .to(commandUri)
>>> > .send();
>>> >
>>> > I am reading from the same URI to feed a route where I log the
>>> exchange:
>>> >
>>> > from(mainRouterConfig.commandEntrypoint())
>>> > .to("log:to.dynamic-router.command.route?showAll=true&multiline=true")
>>> > .to("%s:%s?recipientMode=%s".formatted(
>>> > COMPONENT_SCHEME, mainRouterConfig.routingChannel(), mainRouterConfig
>>> > .recipientMode()));
>>> >
>>> > The exchange property is absent in the log message:
>>> >
>>> >   Id: 453CF424AB353C4-0000000000000000
>>> >  ExchangePattern: InOnly
>>> >  Properties:
>>> >
>>> >
>>> {CamelToEndpoint=log://to.dynamic-router.command.route?multiline=true&showAll=true}
>>> >
>>> >  Headers: {CamelMessageTimestamp=1681420673229,
>>> > CamelPulsarRedeliveryCount=0, event_time=0, key=null, key_bytes=null,
>>> > message_id=0:0:-1, producer_name=standalone-0-11, properties={},
>>> > publish_time=1681420673229
>>> > , sequence_id=0,
>>> > topic_name=non-persistent://public/default/numbers/command}
>>> >  BodyType: byte[]
>>> >  Body: generateNumberstypesequentialstart0limit1000000
>>> >
>>> > Am I doing anything obviously wrong?  Or is the Pulsar component eating
>>> > exchange properties?
>>> >
>>> > Thanks,
>>> > Steve
>>> >
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>
>>

Reply via email to