Croway opened a new pull request, #28179:
URL: https://github.com/apache/camel/pull/28179

   Jira: https://issues.apache.org/jira/browse/CAMEL-25888
   
   ## Problem
   
   The pubnub consumer sets the `CamelPubNubChannel` header to the channel each 
message or presence event was received on. `PubNubProducer.getChannel()` read 
the same header and preferred it over the `channel` configured on its endpoint, 
for every operation (publish, fire, getHistory, getState, setState, hereNow), 
with no way to turn it off.
   
   As a result, a route that consumes from one pubnub endpoint and sends to 
another pubnub endpoint never used the second endpoint's configured channel: 
each message was sent back to the channel it was received on. With a wildcard 
or a comma-separated channel list on the consumer, the channel used by the 
producer changed from message to message.
   
   ```java
   from("pubnub:inbound?subscribeKey=...")
       .to("pubnub:outbound?publishKey=...&subscribeKey=...");
   // before: published to "inbound"; after: published to "outbound"
   ```
   
   ## Change
   
   - `PubNubConstants`: `CHANNEL` (`CamelPubNubChannel`) stays consumer 
metadata. New producer header `OVERRIDE_CHANNEL` (`CamelPubNubOverrideChannel`) 
to choose a different channel explicitly, the same split as camel-kafka's topic 
/ override-topic headers.
   - `PubNubProducer.getChannel()`: reads only `CamelPubNubOverrideChannel`, 
falling back to the endpoint's channel.
   - Regenerated `pubnub.json` and the downstream catalog / endpoint DSL 
metadata.
   - Upgrade guide 4.24: routes that set `CamelPubNubChannel` to pick the 
producer's channel must set `CamelPubNubOverrideChannel` instead.
   
   ## Tests
   
   - 
`PubNubPublishTest#publishUsesConfiguredChannelWhenChannelHeaderIsPresent`: an 
exchange carrying `CamelPubNubChannel` is published to the endpoint's channel.
   - `PubNubPublishTest#publishUsesOverrideChannelHeader`: 
`CamelPubNubOverrideChannel` selects the channel.
   - `PubNubRouteChannelTest#forwardedEventIsPublishedToProducerChannel`: a 
message received on one channel and forwarded to a second pubnub endpoint is 
published to that endpoint's configured channel.
   - The existing consumer assertions on `CamelPubNubChannel` are unchanged. 
All 27 tests of camel-pubnub pass; the three new tests fail without the 
producer change.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to