Skip to content

Commit

Permalink
feat: Customizing Cloudevents validation
Browse files Browse the repository at this point in the history
Signed-off-by: vbhat6 <[email protected]>
  • Loading branch information
vbhat6 committed Feb 15, 2024
1 parent 62c55e7 commit 8c66b1b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.cloudevents.core.test;

import io.cloudevents.CloudEvent;
import io.cloudevents.core.validator.CloudEventValidator;

public class CloudEventCustomValidator implements CloudEventValidator {

@Override
public void validate(CloudEvent cloudEvent) {
String namespace = null;
if ((namespace = (String) cloudEvent.getExtension("namespace")) != null &&
!namespace.equals("sales")){
throw new IllegalStateException("Expecting sales in namespace extension");
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.cloudevents.core.test.CloudEventCustomValidator

0 comments on commit 8c66b1b

Please sign in to comment.