Class MailjetEventsRestController
java.lang.Object
es.kukenan.smartfi.microservice.communication.controller.MailjetEventsRestController
This rest controller has been created to receive the messages generated by the
MailJet "Event API: real-time notifications".
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAuthority (role) required in order to be able to invoke greeting API.static final StringREST API base path.private MailjetEventsServiceMailJet events service that hold event handling logic.private static final StringHealth check result response header.private es.kukenan.smartfi.common.utils.CustomObjectMapperJSON to object mapper.private es.kukenan.smartfi.common.context.RequestContextManagerRequest context manager. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.springframework.http.ResponseEntity<Void>Build the response for a Health Check request of this endpoint.org.springframework.http.ResponseEntity<Void>Entry-point for MailJet event api real time notifications.private StringsafeValueAsString(com.fasterxml.jackson.databind.JsonNode node) Safely map the value as a string.
-
Field Details
-
API_PATH
REST API base path.- See Also:
-
API_AUTHORITY
Authority (role) required in order to be able to invoke greeting API.- See Also:
-
HEALTHCHECK_HEADER_RESULT
Health check result response header.- See Also:
-
eventsService
MailJet events service that hold event handling logic. -
objectMapper
@Autowired private es.kukenan.smartfi.common.utils.CustomObjectMapper objectMapperJSON to object mapper. -
requestContextManager
@Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManagerRequest context manager.
-
-
Constructor Details
-
MailjetEventsRestController
public MailjetEventsRestController()
-
-
Method Details
-
receive
@PostMapping(path="/papi/v1/mailjet/events", consumes="application/json") public org.springframework.http.ResponseEntity<Void> receive(@RequestBody com.fasterxml.jackson.databind.JsonNode body, @RequestParam(name="healthCheck",required=false) Boolean healthCheck) Entry-point for MailJet event api real time notifications.- Parameters:
body- the event notification.healthCheck- health check flag, if present the service will return 204 and do nothing.- Returns:
- if the event is handled, it returns a response with http 200 status. Otherwise, MailJet will try to re-deliver the event in the future.
-
healthCheck
Build the response for a Health Check request of this endpoint.- Returns:
- the response.
-
safeValueAsString
Safely map the value as a string.- Parameters:
node- aJsonNode.- Returns:
- the JSON as string.
-