Package com.atlan.samples.events
Class AbstractNumaflowHandler
- java.lang.Object
-
- io.numaproj.numaflow.function.handlers.MapHandler
-
- com.atlan.samples.events.AbstractNumaflowHandler
-
- Direct Known Subclasses:
NumaflowEnforcer,NumaflowLogger,NumaflowPlaybookRunner,NumaflowScorer
public abstract class AbstractNumaflowHandler extends io.numaproj.numaflow.function.handlers.MapHandlerBase class for event handlers.
-
-
Constructor Summary
Constructors Constructor Description AbstractNumaflowHandler(com.atlan.events.AtlanEventHandler handler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static io.numaproj.numaflow.function.types.MessageListdrop()Drop the message.protected static io.numaproj.numaflow.function.types.MessageListfailed(java.lang.String[] keys, byte[] data)Route the message as failed.protected static io.numaproj.numaflow.function.types.MessageListfailed(java.lang.String[] keys, io.numaproj.numaflow.function.interfaces.Datum data)Route the message as failed.protected static io.numaproj.numaflow.function.types.MessageListforward(byte[] data)Route the message forward, as-is.protected static io.numaproj.numaflow.function.types.MessageListforward(io.numaproj.numaflow.function.interfaces.Datum data)Route the message forward, as-is.protected static com.atlan.model.events.AtlanEventgetAtlanEvent(io.numaproj.numaflow.function.interfaces.Datum data)Translate the Numaflow message into an Atlan event object.com.atlan.events.AtlanEventHandlergetHandler()io.numaproj.numaflow.function.types.MessageListprocessEvent(com.atlan.model.events.AtlanEvent event, java.lang.String[] keys, io.numaproj.numaflow.function.interfaces.Datum data)Handle the Atlan event using the standard 5-step flow: 1.io.numaproj.numaflow.function.types.MessageListprocessMessage(java.lang.String[] keys, io.numaproj.numaflow.function.interfaces.Datum data)protected static io.numaproj.numaflow.function.types.MessageListsucceeded(java.lang.String[] keys, byte[] data)Route the message as succeeded.protected static io.numaproj.numaflow.function.types.MessageListsucceeded(java.lang.String[] keys, io.numaproj.numaflow.function.interfaces.Datum data)Route the message as succeeded.
-
-
-
Field Detail
-
FAILURE
public static final java.lang.String FAILURE
- See Also:
- Constant Field Values
-
SUCCESS
public static final java.lang.String SUCCESS
- See Also:
- Constant Field Values
-
-
Method Detail
-
processEvent
public io.numaproj.numaflow.function.types.MessageList processEvent(com.atlan.model.events.AtlanEvent event, java.lang.String[] keys, io.numaproj.numaflow.function.interfaces.Datum data)Handle the Atlan event using the standard 5-step flow: 1. Validate prerequisites. 2. Retrieve current state of the asset. 3. Apply any changes (in-memory). 4. Determine whether any changes actually would be applied (idempotency). 5. Apply changes back to Atlan (only if (4) shows there are changes to apply).- Parameters:
event- the event payload, from Atlankeys- the Numaflow keys for the messagedata- the Numanflow message itself- Returns:
- an array of messages that can be passed to further vertexes in the pipeline, often produced by one of the helper methods
-
processMessage
public io.numaproj.numaflow.function.types.MessageList processMessage(java.lang.String[] keys, io.numaproj.numaflow.function.interfaces.Datum data)- Specified by:
processMessagein classio.numaproj.numaflow.function.handlers.MapHandler
-
getAtlanEvent
protected static com.atlan.model.events.AtlanEvent getAtlanEvent(io.numaproj.numaflow.function.interfaces.Datum data) throws java.io.IOExceptionTranslate the Numaflow message into an Atlan event object.- Parameters:
data- the Numaflow message- Returns:
- an Atlan event object representation of the message
- Throws:
java.io.IOException- if an Atlan event cannot be parsed from the message
-
failed
protected static io.numaproj.numaflow.function.types.MessageList failed(java.lang.String[] keys, io.numaproj.numaflow.function.interfaces.Datum data)Route the message as failed.- Parameters:
keys- the Numaflow keys for the messagedata- the Numaflow message- Returns:
- a message list indicating the message failed to be processed
-
failed
protected static io.numaproj.numaflow.function.types.MessageList failed(java.lang.String[] keys, byte[] data)Route the message as failed.- Parameters:
keys- the Numaflow keys for the messagedata- the Numaflow message- Returns:
- a message list indicating the message failed to be processed
-
succeeded
protected static io.numaproj.numaflow.function.types.MessageList succeeded(java.lang.String[] keys, io.numaproj.numaflow.function.interfaces.Datum data)Route the message as succeeded.- Parameters:
keys- the Numaflow keys for the messagedata- the Numaflow message- Returns:
- a message list indicating the message was successfully processed
-
succeeded
protected static io.numaproj.numaflow.function.types.MessageList succeeded(java.lang.String[] keys, byte[] data)Route the message as succeeded.- Parameters:
keys- the Numaflow keys for the messagedata- the Numaflow message- Returns:
- a message list indicating the message was successfully processed
-
forward
protected static io.numaproj.numaflow.function.types.MessageList forward(io.numaproj.numaflow.function.interfaces.Datum data)
Route the message forward, as-is.- Parameters:
data- the Numaflow message- Returns:
- a message list indicating the message should be forwarded as-is
-
forward
protected static io.numaproj.numaflow.function.types.MessageList forward(byte[] data)
Route the message forward, as-is.- Parameters:
data- the Numaflow message- Returns:
- a message list indicating the message should be forwarded as-is
-
drop
protected static io.numaproj.numaflow.function.types.MessageList drop()
Drop the message. Mostly this should be used when receiving an event that is the result of this handler taking an action on a previous event. (Without this, we could have an infinite loop of that action being applied over and over again.)- Returns:
- a message list indicating the message can be safely ignored
-
getHandler
public com.atlan.events.AtlanEventHandler getHandler()
-
-