EventGridSubscriber Class

  • java.lang.Object
    • com.microsoft.azure.eventgrid.customization.EventGridSubscriber

public class EventGridSubscriber

The type that can be used to de-serialize eventgrid events.

Constructor Summary

Constructor Description
EventGridSubscriber()

Creates EventGridSubscriber with default de-serializer.

Method Summary

Modifier and Type Method and Description
boolean containsCustomEventMappingFor(String eventType)

Checks if an event mapping with the given eventType exists.

EventGridEvent[] deserializeEventGridEvents(String requestContent)

De-serialize the events in the given requested content using default de-serializer.

EventGridEvent[] deserializeEventGridEvents(String requestContent, SerializerAdapter<ObjectMapper> serializerAdapter)

De-serialize the events in the given requested content using the provided de-serializer.

java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.reflect.Type>> getAllCustomEventMappings()
java.lang.reflect.Type getCustomEventMapping(String eventType)

Get type of the Java model that is mapped to the given eventType.

void putCustomEventMapping(String eventType, Type eventDataType)

Add a custom event mapping.

boolean removeCustomEventMapping(String eventType)

Removes the mapping with the given eventType.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

EventGridSubscriber

public EventGridSubscriber()

Creates EventGridSubscriber with default de-serializer.

Method Details

containsCustomEventMappingFor

public boolean containsCustomEventMappingFor(String eventType)

Checks if an event mapping with the given eventType exists.

Parameters:

eventType - the event type name.

Returns:

true if the mapping exists, false otherwise.

deserializeEventGridEvents

public EventGridEvent[] deserializeEventGridEvents(String requestContent)

De-serialize the events in the given requested content using default de-serializer.

Parameters:

requestContent - the request content in string format.

Returns:

De-serialized events.

Throws:

java.io.IOException

deserializeEventGridEvents

public EventGridEvent[] deserializeEventGridEvents(String requestContent, SerializerAdapter serializerAdapter)

De-serialize the events in the given requested content using the provided de-serializer.

Parameters:

requestContent - the request content as string.
serializerAdapter - the de-serializer.

Returns:

de-serialized events.

Throws:

java.io.IOException

getAllCustomEventMappings

public Set> getAllCustomEventMappings()

Returns:

get all registered custom event mappings.

getCustomEventMapping

public Type getCustomEventMapping(String eventType)

Get type of the Java model that is mapped to the given eventType.

Parameters:

eventType - the event type name.

Returns:

type of the Java model if mapping exists, null otherwise.

putCustomEventMapping

public void putCustomEventMapping(String eventType, Type eventDataType)

Add a custom event mapping. If a mapping with same eventType exists then the old eventDataType is replaced by the specified eventDataType.

Parameters:

eventType - the event type name.
eventDataType - type of the Java model that the event type name mapped to.

removeCustomEventMapping

public boolean removeCustomEventMapping(String eventType)

Removes the mapping with the given eventType.

Parameters:

eventType - the event type name.

Returns:

true if the mapping exists and removed, false if mapping does not exists.

Applies to