What is an Output Type?

Microservices can have either one type of outcome or different types of outcomes. For example:

  1. A function which adds two numbers together will always return a single number.
  2. A function that makes a payment could have a 'success' outcome, returning the successful payment details, or it could have a 'failure' outcome, returning the reason for the failure.

To distinguish between outcomes, we return the OutputType. The OutputType is unique across a project and it allows us to identify the microservice that generated the event and the outcome type.

So for the examples, we could have the following OutputTypes:

  1. AddNumbers
  2. MakePayment.success and MakePayment.failure

When there is more than one possible OutputType, usually only one of these will occur for a single invocation of that microservice.