Interface RouteToEBServiceHandler

All Superinterfaces:
Handler<RoutingContext>

public interface RouteToEBServiceHandler extends Handler<RoutingContext>
Handler that proxy the request to an event bus endpoint, waits for the reply and then writes the HTTP response.
The HTTP request is sent encapsulated into a ServiceRequest object through the event bus. The expected reply is a ServiceResponse
This handler requires a ValidationHandler that process request parameters, so they can be encapsulated by this handler inside the ServiceRequest
Author:
Francesco Guardiani @slinkydeveloper
  • Method Details

    • extraPayloadMapper

      RouteToEBServiceHandler extraPayloadMapper(Function<RoutingContext, JsonObject> extraPayloadMapper)
      When extraPayloadMapper is configured, this handler puts the evaluation result into ServiceRequest.getExtra()
      Parameters:
      extraPayloadMapper - mapper
      Returns:
    • build

      static RouteToEBServiceHandler build(EventBus eventBus, String address, String actionName)
      Build a new RouteToEBServiceHandler
      Parameters:
      eventBus - Vert.x event bus instance
      address - Event bus endpoint address
      actionName - action name of the endpoint. This will be configured as DeliveryOptions header named action
      Returns:
    • build

      static RouteToEBServiceHandler build(EventBus eventBus, String address, String actionName, DeliveryOptions deliveryOptions)
      Build a new RouteToEBServiceHandler
      Parameters:
      eventBus - Vert.x event bus instance
      address - Event bus endpoint address
      actionName - action name of the endpoint. This will be configured as DeliveryOptions header named action
      deliveryOptions - delivery options that will be always sent with the request
      Returns: