Skip to content
This repository has been archived by the owner on Nov 13, 2019. It is now read-only.

rh-event-flow/jcloudevents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Implementation of the CloudEvents Specification

Build Status (Travis CI) License

Simple CDI libray for the CloudEvents Specification

A more detailed introduction is here

Below is a simple overview!

JAX-RS and Apache Kafka support

Adding the jax-rs or kafka module to your application integrates, either the /ce JAX-RS endpoint, or a configurable Kafka consumer for handling CloudEvents from within your application!

Receiving different multi-cloud events, using the CDI API:

public class Monitor {

    public void receiveCloudEventFromAWS(@Observes @EventType(name = "aws.s3.object.created") CloudEvent<?> cloudEvent) {

        System.out.println("S3 event: " + cloudEvent);

    }
    public void receiveCloudEventFromAzure(@Observes @EventType(name = "Microsoft.Storage.BlobCreated") CloudEvent<?> cloudEvent) {

        System.out.println("Azure event: " + cloudEvent);

    }
}

Java SE / Weld-SE support

Vanilla CDI support and APIs for CloudEvents

Creating and firing an event:

public class EventPublisher {

    @Inject
    private Event<CloudEvent<MyCustomEvent>> cloudEvent;

    public void doAndTrigger() throws Exception {

        // do some domain specific stuff...

        CloudEvent<MyCustomEvent> event = new CloudEventBuilder<MyCustomEvent>()
                .eventType("Cloud.Storage.Item.Created")
                .source(new URI("/trigger"))
                .eventID(UUID.randomUUID().toString())
                .build();

        cloudEvent.select(
                    new EventTypeQualifier("Cloud.Storage.Item.Created"))
                .fire(event);

    }
}

Receiving the event

...
    public void receiveCloudEvent(@Observes @EventType(name = "Cloud.Storage.Item.Created") CloudEvent cloudEvent) {

        receiver.ack();
    }

About

jCloudEvents - CloudEvent API for Java

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages