How gateway forwards events to sensor?¶
There are two ways an event is dispatched from gateway to sensor:
- NATS standard or streaming service
To use HTTP as communication channel between gateway and sensor, you need to configure the
eventProtocolin gateway as HTTP. Then, you need to specify the port on which the HTTP server in sensor will be running. The HTTP server is spun up automatically with the port configured in sensor spec when you create the sensor with
You don't need to specify address of sensor pod. The sensor pod is exposed through a ClusterIP service. This is taken care by the sensor controller. The name of the sensor service is formatted in a specific way by sensor controller so that gateway can create the service name from sensor name. This is how gateway gets the name of the service exposing sensor. Using the port defined in the spec, gateway makes HTTP POST requests to sensor service.
- Sensor Example
NATS Standard & Streaming¶
To use NATS standard or streaming as communication channel between gateway and sensor, you need to configure the
eventProtocolin gateway as NATS and type as either
Streaming. You can read more about NATS here
In case of NATS, gateway doesn't need to be aware of sensors because the gateway acts as a publisher and sensors act as subscriber.
You can store events in external persistent volume. This gives you ability to replay events in future for any reasons. Read more about storing NATS messages here
NATS also facilitates the components that are not part of Argo-Events to consume events generated by gateway.
For a sensor to consume the events from NATS, the
eventProtocolneeds to specified as NATS. You can then configure the Standard or Streaming connection detail in
Standard NATS example
Streaming NATS example
Note: The framework does not provide a NATS installation. You can follow this guide to install NATS onto your cluster.