Thanks for the quick reply Mark! Not sure if this can be used with Camel, is there more info available on how to do that? Also, not sure about emailing you outside of the users group. Thanks again! Andy
From: Mark Nuttall <mknutt...@gmail.com> Sent: Tuesday, August 15, 2023 4:09 PM To: users@camel.apache.org Subject: Re: How to receive Server side events https: //urldefense. com/v3/__https: //www. baeldung. com/spring-server-sent-events__;!!AMCWqqRremt4Wx4!VWVl-9Fh0XrgWpciorxekjNL1BayoK18SVNEV5j8J85Un5DbCBP9Q-uuboROGDAFpDQocFR3IXlhHoP1-wk$ On Tue, Aug 15, 2023 at 4: 00 PM Claus Ibsen <claus. ibsen@ gmail. com> ZjQcmQRYFpfptBannerStart This Message Is From an External Sender Use caution opening attachments and links Report Suspicious <https://us-phishalarm-ewt.proofpoint.com/EWT/v1/AMCWqqRremt4Wx4!8W_K76KA_vocYscmXpwXtrqynj8IGtXgaWCB_peZ1idyB6NZqufgBscfiwk0LUCbGWOK0GgNG0Lv00M0-2sGaTiu4Yu_sBF_Ye7lP-y3fY0zYqlF6EiMeHDhTllCNg$> ZjQcmQRYFpfptBannerEnd EXTERNAL EMAIL - Use caution opening attachments and links. https://urldefense.com/v3/__https://www.baeldung.com/spring-server-sent-events__;!!AMCWqqRremt4Wx4!VWVl-9Fh0XrgWpciorxekjNL1BayoK18SVNEV5j8J85Un5DbCBP9Q-uuboROGDAFpDQocFR3IXlhHoP1-wk$<https://urldefense.com/v3/__https:/www.baeldung.com/spring-server-sent-events__;!!AMCWqqRremt4Wx4!VWVl-9Fh0XrgWpciorxekjNL1BayoK18SVNEV5j8J85Un5DbCBP9Q-uuboROGDAFpDQocFR3IXlhHoP1-wk$> On Tue, Aug 15, 2023 at 4:00 PM Claus Ibsen <claus.ib...@gmail.com<mailto:claus.ib...@gmail.com>> wrote: > Hi > > There is no component that out of the box supports SSE with Camel (to my > knowledge). > > We have a JIRA about this > https://urldefense.com/v3/__https://issues.apache.org/jira/browse/CAMEL-16431__;!!AMCWqqRremt4Wx4!VWVl-9Fh0XrgWpciorxekjNL1BayoK18SVNEV5j8J85Un5DbCBP9Q-uuboROGDAFpDQocFR3IXlhmPjKxoA$<https://urldefense.com/v3/__https:/issues.apache.org/jira/browse/CAMEL-16431__;!!AMCWqqRremt4Wx4!VWVl-9Fh0XrgWpciorxekjNL1BayoK18SVNEV5j8J85Un5DbCBP9Q-uuboROGDAFpDQocFR3IXlhmPjKxoA$> > > If you run in a runtime like Spring Boot or Quarkus then they may have some > HTTP template you can use for SSE. > > > > > On Tue, Aug 15, 2023 at 8:44 PM Andrew McCarron > <andrew.mccar...@bd.com.invalid<mailto:andrew.mccar...@bd.com.invalid>> wrote: > > > Greetings! > > I'm fairly new to both java and Camel, and I've been tasked with > > interfacing with a service that sends server side events. > > The server is our own mock server app that I can run in the debugger. > > I've tried to create a route that uses uri:http to connect to the service > > with the following header settings. > > > > > > @Component > > public class GetCPE extends RouteBuilder { > > public void configure() throws Exception { > > from("timer://getCPE?delay=2&repeatCount=1") > > .routeId("get-cpe") > > // Body is set by another route that gets an authorization token > > .setHeader("Authorization", simple("Bearer ${body}")) > > .process(exchange -> exchange.getIn().setBody("")) > > .setHeader(Exchange.HTTP_METHOD, > > constant(org.apache.camel.component.http.HttpMethods.GET)) > > .setHeader("Connection", simple("keep-alive")) > > .setHeader("Accept", simple("text/event-stream")) > > .setHeader("Accept-Encoding", simple("gzip, deflate, br")) > > .setHeader("Postman-Token", > > simple("6ec7dfb3-6a4e-46ad-9f29-329a854f2649")) > > > > .to("https://urldefense.com/v3/__http://localhost:5000/events__;!!AMCWqqRremt4Wx4!VWVl-9Fh0XrgWpciorxekjNL1BayoK18SVNEV5j8J85Un5DbCBP9Q-uuboROGDAFpDQocFR3IXlhQLdbJcY$<https://urldefense.com/v3/__http:/localhost:5000/events__;!!AMCWqqRremt4Wx4!VWVl-9Fh0XrgWpciorxekjNL1BayoK18SVNEV5j8J85Un5DbCBP9Q-uuboROGDAFpDQocFR3IXlhQLdbJcY$>") > > // so far, this is never called > > .log("... response?"); > > > > I know the GET request is received by the service, and that it generates > > the events. > > I've also used Postman to verify that the header settings are correct, > and > > that postman does receive the server events . > > > > Is http the correct way to receive events? > > Are there other configuration or header settings to make http work? > > Do I need to 'capture' each event somehow? > > > > Thanks in advance, Andy > > ******************************************************************* > > IMPORTANT MESSAGE FOR RECIPIENTS IN THE U.S.A.: > > This message may constitute an advertisement of a BD group's products or > > services or a solicitation of interest in them. If this is such a message > > and you would like to opt out of receiving future advertisements or > > solicitations from this BD group, please forward this e-mail to > > optoutbygr...@bd.com<mailto:optoutbygr...@bd.com>. [BD.v1.0] > > ******************************************************************* > > This message (which includes any attachments) is intended only for the > > designated recipient(s). It may contain confidential or proprietary > > information and may be subject to the attorney-client privilege or other > > confidentiality protections. If you are not a designated recipient, you > may > > not review, use, copy or distribute this message. If you received this in > > error, please notify the sender by reply e-mail and delete this message. > > Thank you. > > ******************************************************************* > > Corporate Headquarters Mailing Address: BD (Becton, Dickinson and > Company) > > 1 Becton Drive Franklin Lakes, NJ 07417 U.S.A. > > > > > -- > Claus Ibsen > ----------------- > @davsclaus > Camel in Action 2: > https://urldefense.com/v3/__https://www.manning.com/ibsen2__;!!AMCWqqRremt4Wx4!VWVl-9Fh0XrgWpciorxekjNL1BayoK18SVNEV5j8J85Un5DbCBP9Q-uuboROGDAFpDQocFR3IXlhdzlYMGg$<https://urldefense.com/v3/__https:/www.manning.com/ibsen2__;!!AMCWqqRremt4Wx4!VWVl-9Fh0XrgWpciorxekjNL1BayoK18SVNEV5j8J85Un5DbCBP9Q-uuboROGDAFpDQocFR3IXlhdzlYMGg$> >