Hi

There is no component that out of the box supports SSE with Camel (to my
knowledge).

We have a JIRA about this
https://issues.apache.org/jira/browse/CAMEL-16431

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> 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("http://localhost:5000/events";)
>         // 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. [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://www.manning.com/ibsen2

Reply via email to