Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micronaut module #442

Open
untereiner opened this issue Jan 17, 2022 · 3 comments
Open

Micronaut module #442

untereiner opened this issue Jan 17, 2022 · 3 comments
Labels
discussion enhancement New feature or request

Comments

@untereiner
Copy link

Hi, I am using the Micronaut framework and I have been thinking using CloudEvents between my microservices. Would it be interesting to provide a Micronaut module with the same spirit of the spring boot one to this sdk ?

@lszymik
Copy link

lszymik commented Feb 28, 2022

Hello,
I was also trying to use CloudEvents with Micronaut. It is not working out of the box.
It will be very valuable to have integration.

@pierDipi
Copy link
Member

pierDipi commented Apr 1, 2022

Hello, I've never used Micronout, so I'm don't know if I can maintain the integration, however, I'd like to understand more about the integration with Micronout, does anyone of you have something to show? a public proof of concept?

@pierDipi pierDipi added enhancement New feature or request discussion labels Apr 1, 2022
@BramMeerten
Copy link

BramMeerten commented Jul 18, 2022

I got it working with a few lines of code using io.cloudevents:cloudevents-http-basic and io.micronaut:micronaut-http-client:

@Singleton
public class MyEventPublisher {

    @Inject
    private HttpClient httpClient;

    private final String BROKER_URI = "http://broker-ingress.knative-eventing.svc.cluster.local/my-broker-url";

    Mono<void> sendEvent(CloudEvent event) {
        var request = HttpRequest.POST(URI.create(BROKER_URI), event);
        HttpMessageFactory.createWriter(request::header, request::body).writeBinary(event);

        return Mono.from(httpClient.retrieve(request, Void.class));
    }
}

Would be nice though to get it working with a Declarative Client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants