Class RequestContextManager

java.lang.Object
es.kukenan.smartfi.common.context.RequestContextManager

@Component public class RequestContextManager extends Object
Used as single access point for request context metadata, currently:
  • RequestID - used to correlate actions and events.
  • EntityID - identified the company at a multi-tenant environment.
Note that this manager also has the responsibility to update MDC.
  • Field Details

    • TPP_CHANNEL

      public static final String TPP_CHANNEL
      Constant used to designate third party provider channel.
      See Also:
    • SCHEDULEDTASK_CHANNEL

      public static final String SCHEDULEDTASK_CHANNEL
      Channel for scheduled tasks.
      See Also:
    • propagationConfig

      @Autowired private ContextPropagationProperties propagationConfig
      Context propagation related configuration properties.
  • Constructor Details

    • RequestContextManager

      public RequestContextManager()
  • Method Details

    • getContext

      Get the context.
      Returns:
      the context.
    • patchContext

      Patch the actual context with non-null values in a given input context information.
      Parameters:
      context - the context, if null any previous value will be removed from the context.
      Returns:
      the actual context after patch.
    • updateContext

      public void updateContext(RequestContextManager.WalletContext context)
      Register the context.
      Parameters:
      context - the context, if null any previous value will be removed from the context.
    • setThirdPartyCallbackContext

      public void setThirdPartyCallbackContext(String tppName, String requestId, String companyId, String sessionId)
      Initialize the execution context for a third party provider call.
      Parameters:
      tppName - the third party provider name.
      requestId - request identifier. If null, a new requestId will be generated.
      companyId - company identifier. If null, it is left as null.
      sessionId - session identifier. If null, it will be left as null.
    • setScheduledContext

      public void setScheduledContext(String svcName, String requestId, String companyId, String sessionId)
      Initialize the execution context for a scheduled task.
      Parameters:
      svcName - the service name.
      requestId - request identifier. If null, a new requestId will be generated.
      companyId - company identifier. If null, it is left as null.
      sessionId - session identifier. If null, it will be left as null.
    • reset

      public void reset()
      Completely clear the request context.
    • getAll

      public Map<String,String> getAll()
      Retrieve all the entries at the request context.
      Returns:
      a map with all the entries at the request context.
    • setAll

      public void setAll(Map<String,String> entries)
      Set all the entries at the request context.
      Parameters:
      entries - the entries to set at request context.
    • setRequestProperty

      private void setRequestProperty(String name, String value)
      Set the value of a request context entry.
      Parameters:
      name - the name of the request context entry.
      value - tha new value for the entry.