Re: preserve custom exchange id or custom message id
Ok, got it. 17:18:03 [Camel (camel-1) thread #4 - seda://myqueue] WARN o.a.c.processor.DeadLetterChannel - Failed delivery for (MessageId: ID-BB-123456-58086-1511972278552-0-25 on ExchangeId: ID-BB-123456-58086-58086-1511972278552-0-26). On delivery attempt: 0 The motivation for changing the id was the retry log, which by default logs the exchange and message id which are not related to the data. So I thought I'd just append myid and can then follow the log 2017-11-30 9:14 GMT+01:00 Claus Ibsen-2 [via Camel]: > Read chapter 1 of the CiA2 book which tells you where data lives on > the exchange. > > Only data on the message is part of the "data contract" that can be > transferred over the wire/components and therefore can be preserved. > Data on exchange properties cannot, and so the exchange id neither. > > The breadcrumb is the id that can be transferred over the wire which > is supported out of the box. > > And don't change the exchange id, that is not really for end users to > change, but for the component/camel to setup initially. > > > > On Thu, Nov 30, 2017 at 9:07 AM, Dennis Holunder <[hidden email]> wrote: > >> I'm surprised it is not supported by Camel out of the box. I mean, if >> the route changes the message id, the expectation is clearly that it >> must be preserved. What is the purpose of the id if it is not the same >> in the next route step? >> >> 2017-11-29 17:37 GMT+01:00 Dicken George [via Camel] >> <[hidden email]>: >>> I had a similar situation and i used the MDC logger to add a new header >>> "x-correlation-id" or "x-header-id" and stored my unique id in the >>> exchange >>> as well as on the spring endpoint to track my requests. >>> And with MDCUnitofWork class extension to my class I was able to access >>> my >>> current exchange as well. >>> >>> On Wed, Nov 29, 2017 at 5:19 PM, Dennis Holunder <[hidden email]> >>> wrote: >>> Well, at least in my case its much easier to overwrite the exchange id in each route part. 2017-11-29 17:10 GMT+01:00 Claus Ibsen-2 [via Camel] <[hidden email]>: > Yeah that is correct, so you would have to either overwrite the > existing breadcrumbId header, or use some of your own header for this > "special id" > > On Wed, Nov 29, 2017 at 4:45 PM, Dennis Holunder <[hidden email]> > wrote: > >> but as far as I understand uuid generator doesn't have access to the >> current exchange, so there is no way to append my id from body to the >> exchange id or message id >> >> 2017-11-29 15:02 GMT+01:00 Claus Ibsen-2 [via Camel] >> <[hidden email]>: >>> If you want to have the id transffered over the wire, you cannot use >>> exchange id, as its transient. >>> >>> You can use the breadcrumb-id, and plugin a different uuid generator >>> in >>> Camel. >>> http://camel.apache.org/mdc-logging.html >>> >>> >>> On Wed, Nov 29, 2017 at 2:40 PM, Dennis Holunder <[hidden email]> wrote: >>> Hi, for easier reading logs I'd like to append db record id to the exchange id, but it only works in current route. After the exchange is sent to queue, the appended part is lost from("direct:source") .setBody("id from DB) .process(exchange-> exchange.setExchangeId(exchange.getExchangeId() + "-myid-" + exchange.getIn().getBody())) .process(exchange -> System.out.println(exchange.getExchangeId()) to(queue); // now in queue "-myid-" is not present from(queue()).process(exchange -> System.out.println(exchange.getExchangeId())); Is there a way to preserver the changed id? Dennis >>> >>> >>> >>> -- >>> Claus Ibsen >>> - >>> http://davsclaus.com @davsclaus >>> Camel in Action 2: https://www.manning.com/ibsen2 >>> >>> >>> >>> If you reply to this email, your message will be added to the discussion >>> below: >>> >>> http://camel.465427.n5.nabble.com/preserve-custom-exchange- id-or-custom-message-id-tp5815908p5815909.html >>> To unsubscribe from Camel, click here. >>> NAML > > > > -- > Claus Ibsen > - > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 > > > > If you reply to this email, your message will be added to the > discussion > below: > http://camel.465427.n5.nabble.com/preserve-custom-exchange- id-or-custom-message-id-tp5815908p5815927.html > To unsubscribe from Camel, click here. > NAML >>> >>> >>> >>> -- >>> >>> Dicken George >>> >>>
Re: preserve custom exchange id or custom message id
Read chapter 1 of the CiA2 book which tells you where data lives on the exchange. Only data on the message is part of the "data contract" that can be transferred over the wire/components and therefore can be preserved. Data on exchange properties cannot, and so the exchange id neither. The breadcrumb is the id that can be transferred over the wire which is supported out of the box. And don't change the exchange id, that is not really for end users to change, but for the component/camel to setup initially. On Thu, Nov 30, 2017 at 9:07 AM, Dennis Holunderwrote: > I'm surprised it is not supported by Camel out of the box. I mean, if > the route changes the message id, the expectation is clearly that it > must be preserved. What is the purpose of the id if it is not the same > in the next route step? > > 2017-11-29 17:37 GMT+01:00 Dicken George [via Camel] > : >> I had a similar situation and i used the MDC logger to add a new header >> "x-correlation-id" or "x-header-id" and stored my unique id in the exchange >> as well as on the spring endpoint to track my requests. >> And with MDCUnitofWork class extension to my class I was able to access my >> current exchange as well. >> >> On Wed, Nov 29, 2017 at 5:19 PM, Dennis Holunder <[hidden email]> >> wrote: >> >>> Well, at least in my case its much easier to overwrite the exchange id >>> in each route part. >>> >>> 2017-11-29 17:10 GMT+01:00 Claus Ibsen-2 [via Camel] >>> <[hidden email]>: >>> > Yeah that is correct, so you would have to either overwrite the >>> > existing breadcrumbId header, or use some of your own header for this >>> > "special id" >>> > >>> > On Wed, Nov 29, 2017 at 4:45 PM, Dennis Holunder <[hidden email]> wrote: >>> > >>> >> but as far as I understand uuid generator doesn't have access to the >>> >> current exchange, so there is no way to append my id from body to the >>> >> exchange id or message id >>> >> >>> >> 2017-11-29 15:02 GMT+01:00 Claus Ibsen-2 [via Camel] >>> >> <[hidden email]>: >>> >>> If you want to have the id transffered over the wire, you cannot use >>> >>> exchange id, as its transient. >>> >>> >>> >>> You can use the breadcrumb-id, and plugin a different uuid generator >>> >>> in >>> >>> Camel. >>> >>> http://camel.apache.org/mdc-logging.html >>> >>> >>> >>> >>> >>> On Wed, Nov 29, 2017 at 2:40 PM, Dennis Holunder <[hidden email]> >>> wrote: >>> >>> >>> Hi, >>> >>> for easier reading logs I'd like to append db record id to the >>> exchange id, but it only works in current route. After the exchange >>> is >>> sent to queue, the appended part is lost >>> >>> from("direct:source") >>> .setBody("id from DB) >>> .process(exchange-> >>> exchange.setExchangeId(exchange.getExchangeId() + "-myid-" + >>> exchange.getIn().getBody())) >>> .process(exchange -> System.out.println(exchange.getExchangeId()) >>> to(queue); >>> >>> // now in queue "-myid-" is not present >>> from(queue()).process(exchange -> >>> System.out.println(exchange.getExchangeId())); >>> >>> >>> Is there a way to preserver the changed id? >>> >>> Dennis >>> >>> >>> >>> >>> >>> >>> >>> -- >>> >>> Claus Ibsen >>> >>> - >>> >>> http://davsclaus.com @davsclaus >>> >>> Camel in Action 2: https://www.manning.com/ibsen2 >>> >>> >>> >>> >>> >>> >>> >>> If you reply to this email, your message will be added to the >>> discussion >>> >>> below: >>> >>> >>> >>> http://camel.465427.n5.nabble.com/preserve-custom-exchange- >>> id-or-custom-message-id-tp5815908p5815909.html >>> >>> To unsubscribe from Camel, click here. >>> >>> NAML >>> > >>> > >>> > >>> > -- >>> > Claus Ibsen >>> > - >>> > http://davsclaus.com @davsclaus >>> > Camel in Action 2: https://www.manning.com/ibsen2 >>> > >>> > >>> > >>> > If you reply to this email, your message will be added to the discussion >>> > below: >>> > http://camel.465427.n5.nabble.com/preserve-custom-exchange- >>> id-or-custom-message-id-tp5815908p5815927.html >>> > To unsubscribe from Camel, click here. >>> > NAML >>> >> >> >> >> -- >> >> Dicken George >> >> >> >> If you reply to this email, your message will be added to the discussion >> below: >> http://camel.465427.n5.nabble.com/preserve-custom-exchange-id-or-custom-message-id-tp5815908p5815929.html >> To unsubscribe from Camel, click here. >> NAML -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Re: preserve custom exchange id or custom message id
I'm surprised it is not supported by Camel out of the box. I mean, if the route changes the message id, the expectation is clearly that it must be preserved. What is the purpose of the id if it is not the same in the next route step? 2017-11-29 17:37 GMT+01:00 Dicken George [via Camel]: > I had a similar situation and i used the MDC logger to add a new header > "x-correlation-id" or "x-header-id" and stored my unique id in the exchange > as well as on the spring endpoint to track my requests. > And with MDCUnitofWork class extension to my class I was able to access my > current exchange as well. > > On Wed, Nov 29, 2017 at 5:19 PM, Dennis Holunder <[hidden email]> > wrote: > >> Well, at least in my case its much easier to overwrite the exchange id >> in each route part. >> >> 2017-11-29 17:10 GMT+01:00 Claus Ibsen-2 [via Camel] >> <[hidden email]>: >> > Yeah that is correct, so you would have to either overwrite the >> > existing breadcrumbId header, or use some of your own header for this >> > "special id" >> > >> > On Wed, Nov 29, 2017 at 4:45 PM, Dennis Holunder <[hidden email]> wrote: >> > >> >> but as far as I understand uuid generator doesn't have access to the >> >> current exchange, so there is no way to append my id from body to the >> >> exchange id or message id >> >> >> >> 2017-11-29 15:02 GMT+01:00 Claus Ibsen-2 [via Camel] >> >> <[hidden email]>: >> >>> If you want to have the id transffered over the wire, you cannot use >> >>> exchange id, as its transient. >> >>> >> >>> You can use the breadcrumb-id, and plugin a different uuid generator >> >>> in >> >>> Camel. >> >>> http://camel.apache.org/mdc-logging.html >> >>> >> >>> >> >>> On Wed, Nov 29, 2017 at 2:40 PM, Dennis Holunder <[hidden email]> >> wrote: >> >>> >> Hi, >> >> for easier reading logs I'd like to append db record id to the >> exchange id, but it only works in current route. After the exchange >> is >> sent to queue, the appended part is lost >> >> from("direct:source") >> .setBody("id from DB) >> .process(exchange-> >> exchange.setExchangeId(exchange.getExchangeId() + "-myid-" + >> exchange.getIn().getBody())) >> .process(exchange -> System.out.println(exchange.getExchangeId()) >> to(queue); >> >> // now in queue "-myid-" is not present >> from(queue()).process(exchange -> >> System.out.println(exchange.getExchangeId())); >> >> >> Is there a way to preserver the changed id? >> >> Dennis >> >>> >> >>> >> >>> >> >>> -- >> >>> Claus Ibsen >> >>> - >> >>> http://davsclaus.com @davsclaus >> >>> Camel in Action 2: https://www.manning.com/ibsen2 >> >>> >> >>> >> >>> >> >>> If you reply to this email, your message will be added to the >> discussion >> >>> below: >> >>> >> >>> http://camel.465427.n5.nabble.com/preserve-custom-exchange- >> id-or-custom-message-id-tp5815908p5815909.html >> >>> To unsubscribe from Camel, click here. >> >>> NAML >> > >> > >> > >> > -- >> > Claus Ibsen >> > - >> > http://davsclaus.com @davsclaus >> > Camel in Action 2: https://www.manning.com/ibsen2 >> > >> > >> > >> > If you reply to this email, your message will be added to the discussion >> > below: >> > http://camel.465427.n5.nabble.com/preserve-custom-exchange- >> id-or-custom-message-id-tp5815908p5815927.html >> > To unsubscribe from Camel, click here. >> > NAML >> > > > > -- > > Dicken George > > > > If you reply to this email, your message will be added to the discussion > below: > http://camel.465427.n5.nabble.com/preserve-custom-exchange-id-or-custom-message-id-tp5815908p5815929.html > To unsubscribe from Camel, click here. > NAML
Re: preserve custom exchange id or custom message id
I had a similar situation and i used the MDC logger to add a new header "x-correlation-id" or "x-header-id" and stored my unique id in the exchange as well as on the spring endpoint to track my requests. And with MDCUnitofWork class extension to my class I was able to access my current exchange as well. On Wed, Nov 29, 2017 at 5:19 PM, Dennis Holunderwrote: > Well, at least in my case its much easier to overwrite the exchange id > in each route part. > > 2017-11-29 17:10 GMT+01:00 Claus Ibsen-2 [via Camel] > : > > Yeah that is correct, so you would have to either overwrite the > > existing breadcrumbId header, or use some of your own header for this > > "special id" > > > > On Wed, Nov 29, 2017 at 4:45 PM, Dennis Holunder <[hidden email]> wrote: > > > >> but as far as I understand uuid generator doesn't have access to the > >> current exchange, so there is no way to append my id from body to the > >> exchange id or message id > >> > >> 2017-11-29 15:02 GMT+01:00 Claus Ibsen-2 [via Camel] > >> <[hidden email]>: > >>> If you want to have the id transffered over the wire, you cannot use > >>> exchange id, as its transient. > >>> > >>> You can use the breadcrumb-id, and plugin a different uuid generator in > >>> Camel. > >>> http://camel.apache.org/mdc-logging.html > >>> > >>> > >>> On Wed, Nov 29, 2017 at 2:40 PM, Dennis Holunder <[hidden email]> > wrote: > >>> > Hi, > > for easier reading logs I'd like to append db record id to the > exchange id, but it only works in current route. After the exchange is > sent to queue, the appended part is lost > > from("direct:source") > .setBody("id from DB) > .process(exchange-> > exchange.setExchangeId(exchange.getExchangeId() + "-myid-" + > exchange.getIn().getBody())) > .process(exchange -> System.out.println(exchange.getExchangeId()) > to(queue); > > // now in queue "-myid-" is not present > from(queue()).process(exchange -> > System.out.println(exchange.getExchangeId())); > > > Is there a way to preserver the changed id? > > Dennis > >>> > >>> > >>> > >>> -- > >>> Claus Ibsen > >>> - > >>> http://davsclaus.com @davsclaus > >>> Camel in Action 2: https://www.manning.com/ibsen2 > >>> > >>> > >>> > >>> If you reply to this email, your message will be added to the > discussion > >>> below: > >>> > >>> http://camel.465427.n5.nabble.com/preserve-custom-exchange- > id-or-custom-message-id-tp5815908p5815909.html > >>> To unsubscribe from Camel, click here. > >>> NAML > > > > > > > > -- > > Claus Ibsen > > - > > http://davsclaus.com @davsclaus > > Camel in Action 2: https://www.manning.com/ibsen2 > > > > > > > > If you reply to this email, your message will be added to the discussion > > below: > > http://camel.465427.n5.nabble.com/preserve-custom-exchange- > id-or-custom-message-id-tp5815908p5815927.html > > To unsubscribe from Camel, click here. > > NAML > -- Dicken George
Re: preserve custom exchange id or custom message id
Well, at least in my case its much easier to overwrite the exchange id in each route part. 2017-11-29 17:10 GMT+01:00 Claus Ibsen-2 [via Camel]: > Yeah that is correct, so you would have to either overwrite the > existing breadcrumbId header, or use some of your own header for this > "special id" > > On Wed, Nov 29, 2017 at 4:45 PM, Dennis Holunder <[hidden email]> wrote: > >> but as far as I understand uuid generator doesn't have access to the >> current exchange, so there is no way to append my id from body to the >> exchange id or message id >> >> 2017-11-29 15:02 GMT+01:00 Claus Ibsen-2 [via Camel] >> <[hidden email]>: >>> If you want to have the id transffered over the wire, you cannot use >>> exchange id, as its transient. >>> >>> You can use the breadcrumb-id, and plugin a different uuid generator in >>> Camel. >>> http://camel.apache.org/mdc-logging.html >>> >>> >>> On Wed, Nov 29, 2017 at 2:40 PM, Dennis Holunder <[hidden email]> wrote: >>> Hi, for easier reading logs I'd like to append db record id to the exchange id, but it only works in current route. After the exchange is sent to queue, the appended part is lost from("direct:source") .setBody("id from DB) .process(exchange-> exchange.setExchangeId(exchange.getExchangeId() + "-myid-" + exchange.getIn().getBody())) .process(exchange -> System.out.println(exchange.getExchangeId()) to(queue); // now in queue "-myid-" is not present from(queue()).process(exchange -> System.out.println(exchange.getExchangeId())); Is there a way to preserver the changed id? Dennis >>> >>> >>> >>> -- >>> Claus Ibsen >>> - >>> http://davsclaus.com @davsclaus >>> Camel in Action 2: https://www.manning.com/ibsen2 >>> >>> >>> >>> If you reply to this email, your message will be added to the discussion >>> below: >>> >>> http://camel.465427.n5.nabble.com/preserve-custom-exchange-id-or-custom-message-id-tp5815908p5815909.html >>> To unsubscribe from Camel, click here. >>> NAML > > > > -- > Claus Ibsen > - > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 > > > > If you reply to this email, your message will be added to the discussion > below: > http://camel.465427.n5.nabble.com/preserve-custom-exchange-id-or-custom-message-id-tp5815908p5815927.html > To unsubscribe from Camel, click here. > NAML
Re: preserve custom exchange id or custom message id
Yeah that is correct, so you would have to either overwrite the existing breadcrumbId header, or use some of your own header for this "special id" On Wed, Nov 29, 2017 at 4:45 PM, Dennis Holunderwrote: > but as far as I understand uuid generator doesn't have access to the > current exchange, so there is no way to append my id from body to the > exchange id or message id > > 2017-11-29 15:02 GMT+01:00 Claus Ibsen-2 [via Camel] > : >> If you want to have the id transffered over the wire, you cannot use >> exchange id, as its transient. >> >> You can use the breadcrumb-id, and plugin a different uuid generator in >> Camel. >> http://camel.apache.org/mdc-logging.html >> >> >> On Wed, Nov 29, 2017 at 2:40 PM, Dennis Holunder <[hidden email]> wrote: >> >>> Hi, >>> >>> for easier reading logs I'd like to append db record id to the >>> exchange id, but it only works in current route. After the exchange is >>> sent to queue, the appended part is lost >>> >>> from("direct:source") >>> .setBody("id from DB) >>> .process(exchange-> >>> exchange.setExchangeId(exchange.getExchangeId() + "-myid-" + >>> exchange.getIn().getBody())) >>>.process(exchange -> System.out.println(exchange.getExchangeId()) >>> to(queue); >>> >>> // now in queue "-myid-" is not present >>> from(queue()).process(exchange -> >>> System.out.println(exchange.getExchangeId())); >>> >>> >>> Is there a way to preserver the changed id? >>> >>> Dennis >> >> >> >> -- >> Claus Ibsen >> - >> http://davsclaus.com @davsclaus >> Camel in Action 2: https://www.manning.com/ibsen2 >> >> >> >> If you reply to this email, your message will be added to the discussion >> below: >> http://camel.465427.n5.nabble.com/preserve-custom-exchange-id-or-custom-message-id-tp5815908p5815909.html >> To unsubscribe from Camel, click here. >> NAML -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Re: preserve custom exchange id or custom message id
but as far as I understand uuid generator doesn't have access to the current exchange, so there is no way to append my id from body to the exchange id or message id 2017-11-29 15:02 GMT+01:00 Claus Ibsen-2 [via Camel]: > If you want to have the id transffered over the wire, you cannot use > exchange id, as its transient. > > You can use the breadcrumb-id, and plugin a different uuid generator in > Camel. > http://camel.apache.org/mdc-logging.html > > > On Wed, Nov 29, 2017 at 2:40 PM, Dennis Holunder <[hidden email]> wrote: > >> Hi, >> >> for easier reading logs I'd like to append db record id to the >> exchange id, but it only works in current route. After the exchange is >> sent to queue, the appended part is lost >> >> from("direct:source") >> .setBody("id from DB) >> .process(exchange-> >> exchange.setExchangeId(exchange.getExchangeId() + "-myid-" + >> exchange.getIn().getBody())) >>.process(exchange -> System.out.println(exchange.getExchangeId()) >> to(queue); >> >> // now in queue "-myid-" is not present >> from(queue()).process(exchange -> >> System.out.println(exchange.getExchangeId())); >> >> >> Is there a way to preserver the changed id? >> >> Dennis > > > > -- > Claus Ibsen > - > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 > > > > If you reply to this email, your message will be added to the discussion > below: > http://camel.465427.n5.nabble.com/preserve-custom-exchange-id-or-custom-message-id-tp5815908p5815909.html > To unsubscribe from Camel, click here. > NAML
Re: preserve custom exchange id or custom message id
If you want to have the id transffered over the wire, you cannot use exchange id, as its transient. You can use the breadcrumb-id, and plugin a different uuid generator in Camel. http://camel.apache.org/mdc-logging.html On Wed, Nov 29, 2017 at 2:40 PM, Dennis Holunderwrote: > Hi, > > for easier reading logs I'd like to append db record id to the > exchange id, but it only works in current route. After the exchange is > sent to queue, the appended part is lost > > from("direct:source") > .setBody("id from DB) > .process(exchange-> > exchange.setExchangeId(exchange.getExchangeId() + "-myid-" + > exchange.getIn().getBody())) >.process(exchange -> System.out.println(exchange.getExchangeId()) > to(queue); > > // now in queue "-myid-" is not present > from(queue()).process(exchange -> > System.out.println(exchange.getExchangeId())); > > > Is there a way to preserver the changed id? > > Dennis -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2