Skip to content

Commit

Permalink
feat: Customizing Cloudevents validation
Browse files Browse the repository at this point in the history
  • Loading branch information
vbhat6 committed Feb 15, 2024
1 parent 96ada28 commit ea6b839
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 ea6b839

Please sign in to comment.