Request-Response#
Request-Response Communication Model#
A bi-directional messaging pattern that enables direct communication between participants. Clients can send requests to servers through a service, with each individual request capable of receiving one or multiple streaming responses.
The request-response messaging pattern is ideal for scenarios requiring immediate feedback, data queries, or remote procedure calls. The use of shared memory enables efficient transfer of both request and response payloads.
The pattern is not suitable for cases where one-way communication suffices (publish-subscribe) or when data needs to persist for multiple consumers (blackboard).
Mechanism#
Request-Response over Shared Memory#
The RequestResponse
messaging pattern is implemented using data structures in
shared memory. Separate shared memory segments are used for sending requests
and responses. The following structures are involved:
Payload segment
A region in shared memory used to communicate payload data between participants
The request and response payload structures are often different
Clients have a payload segment to share requests with servers
Servers have a payload segment to share responses with clients
The organization of memory in the payload segment depends on the allocator used in the
iceoryx2
deploymentThis flexibility allows different deployments (e.g. desktop applications vs. safety-critical applications) to utilize a different strategy appropriate to their use-case
Offset Channel
A channel for communicating the offsets of payloads within the payload segment
Each client-server pair has one offset channel for requests and one offset channel for responses
Further Reading#
See how the Event
messaging pattern can be used to coordinate participants.
See how to set up a basic RequestResponse
service.
See how to set up a RequestResponse
service with dynamic memory allocations.