Skip to content

Update Create CDEvent in Readme #78

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

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ public class CDEventsExample {
/*when creating new object of any CDEvent type, the event will be initialized with
context.id, context.type, context.version, context.timestamp
and subject.type */
PipelineRunFinishedCDEvent pipelineRunFinishedCDEvent = new PipelineRunFinishedCDEvent();
PipelinerunFinishedCDEvent pipelinerunFinishedCDEvent = new PipelinerunFinishedCDEvent();

/* set the required context fields to the pipelineRunFinishedCDEvent */
pipelineRunFinishedCDEvent.setSource(URI.create("http://dev.cdevents"));
pipelinerunFinishedCDEvent.setSource(URI.create("http://dev.cdevents"));

/* set the required subject fields to the pipelineRunFinishedCDEvent */
pipelineRunFinishedCDEvent.setSubjectId("/dev/pipeline/run/1");
pipelineRunFinishedCDEvent.setSubjectSource(URI.create("http://dev.pipeline.run/source"));
pipelineRunFinishedCDEvent.setSubjectUrl(URI.create("http://dev.pipeline.run/url"));
pipelineRunFinishedCDEvent.setSubjectOutcome(CDEventConstants.Outcome.SUCCESS);
pipelineRunFinishedCDEvent.setSubjectPipelineName("testPipeline");
pipelineRunFinishedCDEvent.setSubjectErrors("pipelineErrors");
pipelinerunFinishedCDEvent.setSubjectId("/dev/pipeline/run/1");
pipelinerunFinishedCDEvent.setSubjectSource(URI.create("http://dev.pipeline.run/source"));
pipelinerunFinishedCDEvent.setSubjectUrl("http://dev.pipeline.run/url");
pipelinerunFinishedCDEvent.setSubjectOutcome(CDEventConstants.Outcome.SUCCESS.getOutcome());
pipelinerunFinishedCDEvent.setSubjectPipelineName("testPipeline");
pipelinerunFinishedCDEvent.setSubjectErrors("pipelineErrors");

/* Create a CloudEvent from a pipelineRunFinishedCDEvent */
CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(pipelineRunFinishedCDEvent);
CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(pipelinerunFinishedCDEvent);

/* This CDEvent can be sent as CloudEvent using HTTP Protocol Binding,
Refer : https://cloudevents.github.io/sdk-java/http-basic.html
Expand Down