Skip to content

Commit

Permalink
feat(extension): Add flattenEvent parsing to RestEventParser and conv…
Browse files Browse the repository at this point in the history
…ert Groovy to Java in echo-rest (#708)
  • Loading branch information
jonsie committed Nov 25, 2019
1 parent 2533c9c commit 2cbf1d2
Show file tree
Hide file tree
Showing 21 changed files with 670 additions and 504 deletions.
12 changes: 12 additions & 0 deletions echo-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# echo-api

A module for defining plugin extension interfaces.

WARNING: This is an Alpha module and is not stable. Consider this an experiment.

Currently there is one extension point `RestEventParser` which is limited to parsing events
in echo's `RestEventListener`. This is primarily for early iteration and testing purposes.

The more powerful extension point for Echo is likely to be `EchoEventListener` - this would enable a plugin
ecosystem for Echo and also allow us to break existing implementations of `EchoEventListener`
(echo-rest, echo-notifications, echo-telemetry, etc) up into discrete plugins.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@
public interface RestEventParser extends ExtensionPoint {

/**
* Parse an Event prior to POST to the configured URL
* Parse an event prior to POST to the configured URL
*
* @param event {@link Event}
* @return Map, which conforms to the RestEventListener API
*/
Map parse(Event event);
Map<String, Object> parseEvent(Event event);

/**
* Flatten an event prior to POST to configured URL
*
* @param event
* @return FlatEvent, which conforms to the RestEventListener API for flattened events
*/
FlatEvent flattenEvent(Event event);

@Data
class Event {
Expand All @@ -58,4 +66,12 @@ class Metadata {
private Map<String, List> requestHeaders;
private Map<String, String> attributes;
}

@Data
@AllArgsConstructor
@NoArgsConstructor
class FlatEvent {
private String details;
private String content;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2cbf1d2

Please sign in to comment.