Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds an
AgentContextProvider
with defaultDefaultAgentContextProvider
implementation that always returns the same agent context (for a single tenant agent).This allows the tenant module (will be added as a separate module) to implement its own
TenantAgentContextProvider
that will find provide the agent context for a specific tenant. This allows to keep the core lean, while providing more advanced usages of providing the agent context.I added a
contextCorrelationId
to theAgentContext
interface. For now this is not really needed, but this will become really useful when we add tenants. ThecontextCorrelationId
allows to correlate the context with an identifier to make it easier to provide the context for an incoming message. By default we find the tenant based on the recipient public keys of a message, but there's numerous cases where we are processing plaintext messages. By providing the contextCorrelationId we can use this in theAgentContextProvider
to correlate the message to a specific context. In the case of theTenantContextProvider
thecontextCorrelationId
will be thetenantId
.BREAKING CHANGE: the
agent.receiveMessage
method should only be used if you want to process the message in the context of the current agent. This means it fine to use for e.g. processing plaintext connection-less messages, but it shouldn't be used anymore by outbound and inbound transports to process messages. Instead, inject theMessageReceiver
class and callreceiveMessage
on that class instead.