Class BrokeredMessageBuilder
A brokered message builder.
Inheritance
Inherited Members
Namespace: Kephas.Messaging.Distributed
Assembly: Kephas.Messaging.dll
Syntax
public class BrokeredMessageBuilder : IBrokeredMessageBuilder, IInitializable
Constructors
| Improve this Doc View SourceBrokeredMessageBuilder(IAppRuntime, IAuthenticationService)
Initializes a new instance of the BrokeredMessageBuilder class.
Declaration
public BrokeredMessageBuilder(IAppRuntime appRuntime, IAuthenticationService authenticationService)
Parameters
Type | Name | Description |
---|---|---|
IAppRuntime | appRuntime | The application runtime. |
IAuthenticationService | authenticationService | The authentication service. |
BrokeredMessageBuilder(IAppRuntime, IAuthenticationService, IContext)
Initializes a new instance of the BrokeredMessageBuilder class.
Declaration
public BrokeredMessageBuilder(IAppRuntime appRuntime, IAuthenticationService authenticationService, IContext context)
Parameters
Type | Name | Description |
---|---|---|
IAppRuntime | appRuntime | The application runtime. |
IAuthenticationService | authenticationService | The authentication service. |
IContext | context | The context for initialization. |
Properties
| Improve this Doc View SourceAppRuntime
Gets the application runtime.
Declaration
public IAppRuntime AppRuntime { get; }
Property Value
Type | Description |
---|---|
IAppRuntime |
AuthenticationService
Gets the authentication service.
Declaration
public IAuthenticationService AuthenticationService { get; }
Property Value
Type | Description |
---|---|
IAuthenticationService | The authentication service. |
BrokeredMessage
Gets the brokered message.
Declaration
public BrokeredMessage BrokeredMessage { get; }
Property Value
Type | Description |
---|---|
BrokeredMessage | The brokered message. |
Context
Gets the sending context.
Declaration
public IContext Context { get; }
Property Value
Type | Description |
---|---|
IContext | The sending context. |
DefaultTimeout
Gets the default timeout.
Declaration
public static TimeSpan DefaultTimeout { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
Methods
| Improve this Doc View SourceCreateBrokeredMessage()
Creates the brokered message.
Declaration
protected virtual BrokeredMessage CreateBrokeredMessage()
Returns
Type | Description |
---|---|
BrokeredMessage | The new brokered message. |
CreateEndpoint(String)
Creates an endpoint.
Declaration
protected virtual IEndpoint CreateEndpoint(string senderId)
Parameters
Type | Name | Description |
---|---|---|
System.String | senderId | The ID of the message sender. |
Returns
Type | Description |
---|---|
IEndpoint | The new endpoint. |
GetBearerToken(IContext)
Gets the bearer token.
Declaration
protected virtual string GetBearerToken(IContext context)
Parameters
Type | Name | Description |
---|---|---|
IContext | context | The sending context (optional). |
Returns
Type | Description |
---|---|
System.String | The bearer token. |
Initialize(IContext)
Initializes the service.
Declaration
public void Initialize(IContext context = null)
Parameters
Type | Name | Description |
---|---|---|
IContext | context | Optional. An optional context for initialization. |
Of(IBrokeredMessage)
Sets the given brokered message for building. Must be set before calling Initialize(IContext).
Declaration
public IBrokeredMessageBuilder Of(IBrokeredMessage brokeredMessage)
Parameters
Type | Name | Description |
---|---|---|
IBrokeredMessage | brokeredMessage | The brokered message. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | This IBrokeredMessageBuilder. |
OneWay()
Makes the communication one way.
Declaration
public virtual BrokeredMessageBuilder OneWay()
Returns
Type | Description |
---|---|
BrokeredMessageBuilder | This BrokeredMessageBuilder. |
ReplyTo(IBrokeredMessage)
Makes the message as a reply to another message.
Declaration
public virtual BrokeredMessageBuilder ReplyTo(IBrokeredMessage message)
Parameters
Type | Name | Description |
---|---|---|
IBrokeredMessage | message | The message to reply to. |
Returns
Type | Description |
---|---|
BrokeredMessageBuilder | A BrokeredMessageBuilder. |
ReplyTo(String, IEndpoint[])
Makes the message as a reply to another message.
Declaration
public virtual BrokeredMessageBuilder ReplyTo(string messageId, params IEndpoint[] recipients)
Parameters
Type | Name | Description |
---|---|---|
System.String | messageId | Identifier for the message. |
IEndpoint[] | recipients | A variable-length parameters list containing recipients. |
Returns
Type | Description |
---|---|
BrokeredMessageBuilder | A BrokeredMessageBuilder. |
Timeout(TimeSpan)
Sets the timeout when waiting for an answer.
Declaration
public virtual BrokeredMessageBuilder Timeout(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | timeout | The timeout. |
Returns
Type | Description |
---|---|
BrokeredMessageBuilder | A BrokeredMessageBuilder. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the timeout is negative. |
UseChannel(String)
Sets the channel to use.
Declaration
public virtual IBrokeredMessageBuilder UseChannel(string channel)
Parameters
Type | Name | Description |
---|---|---|
System.String | channel | The channel. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | This IBrokeredMessageBuilder. |
WithContent(IMessage)
Sets the content message. An event content makes the message one-way.
Declaration
public virtual BrokeredMessageBuilder WithContent(IMessage message)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | The message. |
Returns
Type | Description |
---|---|
BrokeredMessageBuilder | This BrokeredMessageBuilder. |
WithRecipients(IEndpoint[])
Sets the recipients to the brokered message.
Declaration
public virtual BrokeredMessageBuilder WithRecipients(params IEndpoint[] recipients)
Parameters
Type | Name | Description |
---|---|---|
IEndpoint[] | recipients | The recipients. |
Returns
Type | Description |
---|---|
BrokeredMessageBuilder | This BrokeredMessageBuilder. |
WithRecipients(IEnumerable<IEndpoint>)
Sets the recipients to the brokered message.
Declaration
public virtual BrokeredMessageBuilder WithRecipients(IEnumerable<IEndpoint> recipients)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IEndpoint> | recipients | The recipients. |
Returns
Type | Description |
---|---|
BrokeredMessageBuilder | This BrokeredMessageBuilder. |
WithSender(IEndpoint)
Sets the sender of the brokered message.
Declaration
public virtual BrokeredMessageBuilder WithSender(IEndpoint sender)
Parameters
Type | Name | Description |
---|---|---|
IEndpoint | sender | The message sender. |
Returns
Type | Description |
---|---|
BrokeredMessageBuilder | This BrokeredMessageBuilder. |
WithSender(String)
Sets the sender of the brokered message.
Declaration
public virtual BrokeredMessageBuilder WithSender(string senderId)
Parameters
Type | Name | Description |
---|---|---|
System.String | senderId | The ID of the message sender. |
Returns
Type | Description |
---|---|
BrokeredMessageBuilder | This BrokeredMessageBuilder. |
WithSender(Uri)
Sets the sender of the brokered message.
Declaration
public virtual BrokeredMessageBuilder WithSender(Uri sender)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | sender | The message sender. |
Returns
Type | Description |
---|---|
BrokeredMessageBuilder | This BrokeredMessageBuilder. |
Explicit Interface Implementations
| Improve this Doc View SourceIBrokeredMessageBuilder.BrokeredMessage
Gets the brokered message.
Declaration
IBrokeredMessage IBrokeredMessageBuilder.BrokeredMessage { get; }
Returns
Type | Description |
---|---|
IBrokeredMessage | The brokered message. |
IBrokeredMessageBuilder.OneWay()
Makes the communication one way.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.OneWay()
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | This BrokeredMessageBuilder. |
IBrokeredMessageBuilder.ReplyTo(IBrokeredMessage)
Makes the message as a reply to another message.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.ReplyTo(IBrokeredMessage message)
Parameters
Type | Name | Description |
---|---|---|
IBrokeredMessage | message | The message to reply to. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | A BrokeredMessageBuilder. |
IBrokeredMessageBuilder.ReplyTo(String, IEndpoint[])
Makes the message as a reply to another message.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.ReplyTo(string messageId, params IEndpoint[] recipients)
Parameters
Type | Name | Description |
---|---|---|
System.String | messageId | Identifier for the message. |
IEndpoint[] | recipients | A variable-length parameters list containing recipients. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | A BrokeredMessageBuilder. |
IBrokeredMessageBuilder.Timeout(TimeSpan)
Sets the timeout when waiting for an answer.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.Timeout(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | timeout | The timeout. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | A BrokeredMessageBuilder. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the timeout is negative. |
IBrokeredMessageBuilder.UseChannel(String)
Sets the channel to use.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.UseChannel(string channel)
Parameters
Type | Name | Description |
---|---|---|
System.String | channel | The channel. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | This IBrokeredMessageBuilder. |
IBrokeredMessageBuilder.WithContent(IMessage)
Sets the content message.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.WithContent(IMessage message)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | The message. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | This BrokeredMessageBuilder. |
IBrokeredMessageBuilder.WithRecipients(IEndpoint[])
Sets the recipients to the brokered message.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.WithRecipients(params IEndpoint[] recipients)
Parameters
Type | Name | Description |
---|---|---|
IEndpoint[] | recipients | The recipients. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | This BrokeredMessageBuilder. |
IBrokeredMessageBuilder.WithRecipients(IEnumerable<IEndpoint>)
Sets the recipients to the brokered message.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.WithRecipients(IEnumerable<IEndpoint> recipients)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IEndpoint> | recipients | The recipients. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | This BrokeredMessageBuilder. |
IBrokeredMessageBuilder.WithSender(IEndpoint)
Sets the sender of the brokered message.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.WithSender(IEndpoint sender)
Parameters
Type | Name | Description |
---|---|---|
IEndpoint | sender | The message sender. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | This BrokeredMessageBuilder. |
IBrokeredMessageBuilder.WithSender(String)
Sets the sender of the brokered message.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.WithSender(string senderId)
Parameters
Type | Name | Description |
---|---|---|
System.String | senderId | The ID of the message sender. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | This BrokeredMessageBuilder. |
IBrokeredMessageBuilder.WithSender(Uri)
Sets the sender of the brokered message.
Declaration
IBrokeredMessageBuilder IBrokeredMessageBuilder.WithSender(Uri sender)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | sender | The message sender. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | This BrokeredMessageBuilder. |