Documentation ¶
Index ¶
- func GetMessageAs[T any](envelope *MessageEnvelope) (T, error)
- type CallbackMessageReceiver
- type IMessageQueue
- type IMessageQueueOverrides
- type IMessageReceiver
- type LockedMessage
- type MemoryMessageQueue
- func (c *MemoryMessageQueue) Abandon(ctx context.Context, message *MessageEnvelope) (err error)
- func (c *MemoryMessageQueue) Clear(ctx context.Context, correlationId string) (err error)
- func (c *MemoryMessageQueue) Close(ctx context.Context, correlationId string) (err error)
- func (c *MemoryMessageQueue) Complete(ctx context.Context, message *MessageEnvelope) (err error)
- func (c *MemoryMessageQueue) EndListen(ctx context.Context, correlationId string)
- func (c *MemoryMessageQueue) IsOpen() bool
- func (c *MemoryMessageQueue) Listen(ctx context.Context, correlationId string, receiver IMessageReceiver) error
- func (c *MemoryMessageQueue) MoveToDeadLetter(ctx context.Context, message *MessageEnvelope) (err error)
- func (c *MemoryMessageQueue) Open(ctx context.Context, correlationId string) (err error)
- func (c *MemoryMessageQueue) Peek(ctx context.Context, correlationId string) (result *MessageEnvelope, err error)
- func (c *MemoryMessageQueue) PeekBatch(ctx context.Context, correlationId string, messageCount int64) (result []*MessageEnvelope, err error)
- func (c *MemoryMessageQueue) ReadMessageCount() (count int64, err error)
- func (c *MemoryMessageQueue) Receive(ctx context.Context, correlationId string, waitTimeout time.Duration) (*MessageEnvelope, error)
- func (c *MemoryMessageQueue) RenewLock(ctx context.Context, message *MessageEnvelope, lockTimeout time.Duration) (err error)
- func (c *MemoryMessageQueue) Send(ctx context.Context, correlationId string, envelope *MessageEnvelope) (err error)
- type MessageEnvelope
- func (c *MessageEnvelope) GetMessageAsString() string
- func (c *MessageEnvelope) GetReference() any
- func (c MessageEnvelope) MarshalJSON() ([]byte, error)
- func (c *MessageEnvelope) SetMessageAsObject(value any)
- func (c *MessageEnvelope) SetMessageAsString(value string)
- func (c *MessageEnvelope) SetReference(value any)
- func (c *MessageEnvelope) String() string
- func (c *MessageEnvelope) UnmarshalJSON(data []byte) error
- type MessageQueue
- func (c *MessageQueue) BeginListen(ctx context.Context, correlationId string, receiver IMessageReceiver)
- func (c *MessageQueue) Capabilities() *MessagingCapabilities
- func (c *MessageQueue) CheckOpen(correlationId string) error
- func (c *MessageQueue) Configure(ctx context.Context, config *cconf.ConfigParams)
- func (c *MessageQueue) Name() string
- func (c *MessageQueue) Open(ctx context.Context, correlationId string) error
- func (c *MessageQueue) OpenWithParams(ctx context.Context, correlationId string, ...) error
- func (c *MessageQueue) SendAsObject(ctx context.Context, correlationId string, messageType string, message any) (err error)
- func (c *MessageQueue) SetReferences(ctx context.Context, references cref.IReferences)
- func (c *MessageQueue) String() string
- type MessagingCapabilities
- func (c *MessagingCapabilities) CanAbandon() bool
- func (c *MessagingCapabilities) CanClear() bool
- func (c *MessagingCapabilities) CanDeadLetter() bool
- func (c *MessagingCapabilities) CanMessageCount() bool
- func (c *MessagingCapabilities) CanPeek() bool
- func (c *MessagingCapabilities) CanPeekBatch() bool
- func (c *MessagingCapabilities) CanReceive() bool
- func (c *MessagingCapabilities) CanRenewLock() bool
- func (c *MessagingCapabilities) CanSend() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMessageAs ¶
func GetMessageAs[T any](envelope *MessageEnvelope) (T, error)
GetMessageAs method are returns the value that was stored in this message as object.
see SetMessageAsObject
Types ¶
type CallbackMessageReceiver ¶
type CallbackMessageReceiver struct {
Callback func(message *MessageEnvelope, queue IMessageQueue) error
}
CallbackMessageReceiver allows to wrap message callback into IMessageReceiver
func NewCallbackMessageReceiver ¶
func NewCallbackMessageReceiver(callback func(message *MessageEnvelope, queue IMessageQueue) error) *CallbackMessageReceiver
func (*CallbackMessageReceiver) ReceiveMessage ¶
func (c *CallbackMessageReceiver) ReceiveMessage(message *MessageEnvelope, queue IMessageQueue) (err error)
type IMessageQueue ¶
type IMessageQueue interface { crun.IOpenable // Name are gets the queue name // Returns: the queue name. Name() string // Capabilities method are gets the queue capabilities // Returns: the queue's capabilities object. Capabilities() *MessagingCapabilities // ReadMessageCount method are reads the current number of messages in the queue to be delivered. // Returns: number of messages or error. ReadMessageCount() (count int64, err error) // Send method are sends a message into the queue. // Parameters: // - ctx context.Context operation context // - correlationId (optional) transaction id to trace execution through call chain. // - envelope a message envelop to be sent. // Returns: error or nil for success. Send(ctx context.Context, correlationId string, envelope *MessageEnvelope) error // SendAsObject method are sends an object into the queue. // Before sending the object is converted into JSON string and wrapped in a MessageEnvelop. // Parameters: // - ctx context.Context operation context // - correlationId (optional) transaction id to trace execution through call chain. // - messageType a message type // - value an object value to be sent // Returns: error or nil for success. // see Send SendAsObject(ctx context.Context, correlationId string, messageType string, value any) error // Peek method are peeks a single incoming message from the queue without removing it. // If there are no messages available in the queue it returns nil. // Parameters: // - ctx context.Context operation context // - correlationId (optional) transaction id to trace execution through call chain. // Returns: received message or error. Peek(ctx context.Context, correlationId string) (result *MessageEnvelope, err error) // PeekBatch method are peeks multiple incoming messages from the queue without removing them. // If there are no messages available in the queue it returns an empty list. // Parameters: // - ctx context.Context operation conte // - correlationId (optional) transaction id to trace execution through call chain. // - messageCount a maximum number of messages to peek. // Returns: list with messages or error. PeekBatch(ctx context.Context, correlationId string, messageCount int64) (result []*MessageEnvelope, err error) // Receive method are receives an incoming message and removes it from the queue. // Parameters: // - ctx context.Context operation conte // - correlationId (optional) transaction id to trace execution through call chain. // - waitTimeout a timeout in milliseconds to wait for a message to come. // Returns: a message or error. Receive(ctx context.Context, correlationId string, waitTimeout time.Duration) (result *MessageEnvelope, err error) // RenewLock method are renews a lock on a message that makes it invisible from other receivers in the queue. // This method is usually used to extend the message processing time. // Parameters: // - ctx context.Context operation conte // - message a message to extend its lock. // - lockTimeout a locking timeout in milliseconds. // Returns: error or nil for success. RenewLock(ctx context.Context, message *MessageEnvelope, lockTimeout time.Duration) error // Complete method are permanently removes a message from the queue. // This method is usually used to remove the message after successful processing. // Parameters: // - ctx context.Context operation context // - message a message to remove. // Returns: error or nil for success. Complete(ctx context.Context, message *MessageEnvelope) error // Abandon method are returns message into the queue and makes it available for all subscribers to receive it again. // This method is usually used to return a message which could not be processed at the moment // to repeat the attempt. Messages that cause unrecoverable errors shall be removed permanently // or/and send to dead letter queue. // Parameters: // - ctx context.Context operation context // - message a message to return. // Returns: error or nil for success. Abandon(ctx context.Context, message *MessageEnvelope) error // MoveToDeadLetter method are permanently removes a message from the queue and sends it to dead letter queue. // Parameters: // - ctx context.Context operation context // - message a message to be removed. // Results: error or nil for success. MoveToDeadLetter(ctx context.Context, message *MessageEnvelope) error // Listen method are listens for incoming messages and blocks the current thread until queue is closed. // Parameters: // - ctx context.Context operation context // - correlationId (optional) transaction id to trace execution through call chain. // - receiver a receiver to receive incoming messages. // see IMessageReceiver // see receive Listen(ctx context.Context, correlationId string, receiver IMessageReceiver) error // BeginListen method are listens for incoming messages without blocking the current thread. // Parameters: // - ctx context.Context operation context // - correlationId (optional) transaction id to trace execution through call chain. // - receiver a receiver to receive incoming messages. // see listen // see IMessageReceiver BeginListen(ctx context.Context, correlationId string, receiver IMessageReceiver) // EndListen method are ends listening for incoming messages. // When this method is call listen unblocks the thread and execution continues. // Parameters: // - ctx context.Context operation context // - correlationId (optional) transaction id to trace execution through call chain. EndListen(ctx context.Context, correlationId string) }
IMessageQueue Interface for asynchronous message queues.
Not all queues may implement all the methods. Attempt to call non-supported method will result in NotImplemented exception. To verify if specific method is supported consult with MessagingCapabilities.
see MessageEnvelop see MessagingCapabilities
type IMessageQueueOverrides ¶
type IMessageQueueOverrides interface { IMessageQueue // OpenWithParams method are opens the component with given connection and credential parameters. // Parameters: // - correlationId (optional) transaction id to trace execution through call chain. // - connections is a connection parameters // - credential is a credential parameters // Returns: error or nil no errors occured. OpenWithParams(ctx context.Context, correlationId string, connections []*cconn.ConnectionParams, credential *cauth.CredentialParams) error }
type IMessageReceiver ¶
type IMessageReceiver interface { // ReceiveMessage method are receives incoming message from the queue. // Parameters: // - ctx context.Context operation context // - envelope an incoming message // - queue a queue where the message comes from // see: MessageEnvelope // see: IMessageQueue ReceiveMessage(ctx context.Context, envelope *MessageEnvelope, queue IMessageQueue) (err error) }
IMessageReceiver callback interface to receive incoming messages.
Example: type MyMessageReceiver struct { func (c*MyMessageReceiver) ReceiveMessage(ctx context.Context, envelop MessageEnvelop, queue IMessageQueue) { fmt.Println("Received message: " + envelop.GetMessageAsString()); } } messageQueue := NewMemoryMessageQueue(); messageQueue.Listen("123", NewMyMessageReceiver()); opnErr := messageQueue.Open("123") if opnErr == nil{ messageQueue.Send("123", NewMessageEnvelope("", "mymessage", "ABC")); // Output in console: "Received message: ABC" }
type LockedMessage ¶
type LockedMessage struct { Message *MessageEnvelope `json:"message" bson:"message"` // The incoming message. ExpirationTime time.Time `json:"expiration_time" bson:"expiration_time"` // The expiration time for the message lock. If it is null then the message is not locked. Timeout time.Duration `json:"timeout" bson:"timeout"` // The lock timeout in milliseconds. }
LockedMessage data object used to store and lock incoming messages in MemoryMessageQueue.
see: MemoryMessageQueue
type MemoryMessageQueue ¶
type MemoryMessageQueue struct { MessageQueue // contains filtered or unexported fields }
MemoryMessageQueue Message queue that sends and receives messages within the same process by using shared memory. This queue is typically used for testing to mock real queues.
Configuration parameters: - name: name of the message queue References: - *:logger:*:*:1.0 (optional) ILogger components to pass log messages - *:counters:*:*:1.0 (optional) ICounters components to pass collected measurements see MessageQueue see MessagingCapabilities Example: queue := NewMessageQueue("myqueue"); queue.Send(context.Background(), "123", NewMessageEnvelop("", "mymessage", "ABC")); message, err := queue.Receive(contex.Backgroudn(), "123", 10000*time.Milliseconds) if (message != nil) { ... queue.Complete(ctx, message); }
func NewMemoryMessageQueue ¶
func NewMemoryMessageQueue(name string) *MemoryMessageQueue
NewMemoryMessageQueue method are creates a new instance of the message queue.
Parameters: - name (optional) a queue name. Returns: *MemoryMessageQueue see MessagingCapabilities
func (*MemoryMessageQueue) Abandon ¶
func (c *MemoryMessageQueue) Abandon(ctx context.Context, message *MessageEnvelope) (err error)
Abandon method are returns message into the queue and makes it available for all subscribers to receive it again. This method is usually used to return a message which could not be processed at the moment to repeat the attempt. Messages that cause unrecoverable errors shall be removed permanently or/and send to dead letter queue.
Parameters: - ctx context.Context operation context - message a message to return. Returns: error or nil for success.
func (*MemoryMessageQueue) Clear ¶
func (c *MemoryMessageQueue) Clear(ctx context.Context, correlationId string) (err error)
Clear method are clears component state.
Parameters: - ctx context.Context operation context - correlationId (optional) transaction id to trace execution through call chain. Returns: error or nil no errors occured.
func (*MemoryMessageQueue) Close ¶
func (c *MemoryMessageQueue) Close(ctx context.Context, correlationId string) (err error)
Close method are closes component and frees used resources.
Parameters: - ctx context.Context operation context - correlationId (optional) transaction id to trace execution through call chain. Returns: error or nil no errors occured.
func (*MemoryMessageQueue) Complete ¶
func (c *MemoryMessageQueue) Complete(ctx context.Context, message *MessageEnvelope) (err error)
Complete method are permanently removes a message from the queue. This method is usually used to remove the message after successful processing.
Parameters: - ctx context.Context operation context - message a message to remove. Returns: error or nil for success.
func (*MemoryMessageQueue) EndListen ¶
func (c *MemoryMessageQueue) EndListen(ctx context.Context, correlationId string)
EndListen method are ends listening for incoming messages. When c method is call listen unblocks the thread and execution continues.
Parameters: - ctx context.Context operation context - correlationId (optional) transaction id to trace execution through call chain.
func (*MemoryMessageQueue) IsOpen ¶
func (c *MemoryMessageQueue) IsOpen() bool
IsOpen method are checks if the component is opened.
Returns: true if the component has been opened and false otherwise.
func (*MemoryMessageQueue) Listen ¶
func (c *MemoryMessageQueue) Listen(ctx context.Context, correlationId string, receiver IMessageReceiver) error
Listen method are listens for incoming messages and blocks the current thread until queue is closed.
Parameters: - ctx context.Context operation context - correlationId (optional) transaction id to trace execution through call chain. - receiver a receiver to receive incoming messages. see IMessageReceiver see Receive
func (*MemoryMessageQueue) MoveToDeadLetter ¶
func (c *MemoryMessageQueue) MoveToDeadLetter(ctx context.Context, message *MessageEnvelope) (err error)
MoveToDeadLetter method are permanently removes a message from the queue and sends it to dead letter queue.
Parameters: - ctx context.Context operation context - message a message to be removed. Returns: error or nil for success.
func (*MemoryMessageQueue) Open ¶
func (c *MemoryMessageQueue) Open(ctx context.Context, correlationId string) (err error)
Open method are opens the component with given connection and credential parameters.
Parameters: - ctx context.Context operation context - correlationId (optional) transaction id to trace execution through call chain. - connection is a connection parameters - credential is a credential parameters Returns: error or nil no errors occured.
func (*MemoryMessageQueue) Peek ¶
func (c *MemoryMessageQueue) Peek(ctx context.Context, correlationId string) (result *MessageEnvelope, err error)
Peek meethod are peeks a single incoming message from the queue without removing it. If there are no messages available in the queue it returns nil.
Parameters: - ctx context.Context operation context - correlationId (optional) transaction id to trace execution through call chain. Returns: a message or error.
func (*MemoryMessageQueue) PeekBatch ¶
func (c *MemoryMessageQueue) PeekBatch(ctx context.Context, correlationId string, messageCount int64) (result []*MessageEnvelope, err error)
PeekBatch method are peeks multiple incoming messages from the queue without removing them. If there are no messages available in the queue it returns an empty list.
Parameters: - ctx context.Context operation context - correlationId (optional) transaction id to trace execution through call chain. - messageCount a maximum number of messages to peek. Returns: a list with messages or error.
func (*MemoryMessageQueue) ReadMessageCount ¶
func (c *MemoryMessageQueue) ReadMessageCount() (count int64, err error)
ReadMessageCount method are reads the current number of messages in the queue to be delivered.
Returns: number of messages or error.
func (*MemoryMessageQueue) Receive ¶
func (c *MemoryMessageQueue) Receive(ctx context.Context, correlationId string, waitTimeout time.Duration) (*MessageEnvelope, error)
Receive method are receives an incoming message and removes it from the queue.
Parameters: - ctx context.Context operation context - correlationId (optional) transaction id to trace execution through call chain. - waitTimeout a timeout in milliseconds to wait for a message to come. Returns: a message or error.
func (*MemoryMessageQueue) RenewLock ¶
func (c *MemoryMessageQueue) RenewLock(ctx context.Context, message *MessageEnvelope, lockTimeout time.Duration) (err error)
RenewLock method are renews a lock on a message that makes it invisible from other receivers in the queue. This method is usually used to extend the message processing time.
Parameters: - ctx context.Context operation context - message a message to extend its lock. - lockTimeout a locking timeout in milliseconds. Returns: error or nil for success.
func (*MemoryMessageQueue) Send ¶
func (c *MemoryMessageQueue) Send(ctx context.Context, correlationId string, envelope *MessageEnvelope) (err error)
Send method are sends a message into the queue.
Parameters: - ctx context.Context operation context - correlationId (optional) transaction id to trace execution through call chain. - envelope a message envelop to be sent. Returns: error or nil for success.
type MessageEnvelope ¶
type MessageEnvelope struct { CorrelationId string `json:"correlation_id" bson:"correlation_id"` // The unique business transaction id that is used to trace calls across components. MessageId string `json:"message_id" bson:"message_id"` // The message"s auto-generated ID. MessageType string `json:"message_type" bson:"message_type"` // String value that defines the stored message"s type. SentTime time.Time `json:"sent_time" bson:"sent_time"` // The time at which the message was sent. Message []byte `json:"message" bson:"message"` // The stored message. JsonMapConvertor cconv.IJSONEngine[map[string]any] // contains filtered or unexported fields }
MessageEnvelope allows adding additional information to messages. A correlation id, message id, and a message type are added to the data being sent/received. Additionally, a MessageEnvelope can reference a lock token. Side note: a MessageEnvelope"s message is stored as a buffer, so strings are converted using utf8 conversions.
func NewEmptyMessageEnvelope ¶
func NewEmptyMessageEnvelope() *MessageEnvelope
NewEmptyMessageEnvelope method are creates an empty MessageEnvelope
Returns: *MessageEnvelope new instance
func NewMessageEnvelope ¶
func NewMessageEnvelope(correlationId string, messageType string, message []byte) *MessageEnvelope
NewMessageEnvelope method are creates a new MessageEnvelope, which adds a correlation id, message id, and a type to the data being sent/received.
Parameters: - correlationId (optional) transaction id to trace execution through call chain. - messageType a string value that defines the message"s type. - message the data being sent/received. Returns: *MessageEnvelope new instance
func NewMessageEnvelopeFromObject ¶
func NewMessageEnvelopeFromObject(correlationId string, messageType string, message any) *MessageEnvelope
NewMessageEnvelopeFromObject method are creates a new MessageEnvelope, which adds a correlation id, message id, and a type to the data object being sent/received.
Parameters: - correlationId (optional) transaction id to trace execution through call chain. - messageType a string value that defines the message"s type. - message the data object being sent/received. Returns: *MessageEnvelope new instance
func (*MessageEnvelope) GetMessageAsString ¶
func (c *MessageEnvelope) GetMessageAsString() string
GetMessageAsString method are returns the information stored in this message as a string.
func (*MessageEnvelope) GetReference ¶
func (c *MessageEnvelope) GetReference() any
GetReference method are returns the lock token that this MessageEnvelope references.
func (MessageEnvelope) MarshalJSON ¶
func (c MessageEnvelope) MarshalJSON() ([]byte, error)
func (*MessageEnvelope) SetMessageAsObject ¶
func (c *MessageEnvelope) SetMessageAsObject(value any)
SetMessageAsObject method are stores the given value as a JSON string.
Parameters: - value the value to convert to JSON and store in this message. see GetMessageAs
func (*MessageEnvelope) SetMessageAsString ¶
func (c *MessageEnvelope) SetMessageAsString(value string)
SetMessageAsString method are stores the given string.
Parameters: - value the string to set. Will be converted to a bufferg.
func (*MessageEnvelope) SetReference ¶
func (c *MessageEnvelope) SetReference(value any)
SetReference method are sets a lock token reference for this MessageEnvelope.
Parameters: - value the lock token to reference.
func (*MessageEnvelope) String ¶
func (c *MessageEnvelope) String() string
String method are convert"s this MessageEnvelope to a string, using the following format: <correlation_id>,<MessageType>,<message.toString> If any of the values are nil, they will be replaced with ---.
Returns: the generated string.
func (*MessageEnvelope) UnmarshalJSON ¶
func (c *MessageEnvelope) UnmarshalJSON(data []byte) error
type MessageQueue ¶
type MessageQueue struct { Overrides IMessageQueueOverrides Logger *clog.CompositeLogger Counters *ccount.CompositeCounters ConnectionResolver *cconn.ConnectionResolver CredentialResolver *cauth.CredentialResolver Lock sync.Mutex // contains filtered or unexported fields }
MessageQueue message queue that is used as a basis for specific message queue implementations.
Configuration parameters: - name: name of the message queue - connection(s): - discovery_key: key to retrieve parameters from discovery service - protocol: connection protocol like http, https, tcp, udp - host: host name or IP address - port: port number - uri: resource URI or connection string with all parameters in it - credential(s): - store_key: key to retrieve parameters from credential store - username: user name - password: user password - access_id: application access id - access_key: application secret key References: - *:Logger:*:*:1.0 (optional) ILogger components to pass log messages - *:Counters:*:*:1.0 (optional) ICounters components to pass collected measurements - *:discovery:*:*:1.0 (optional) IDiscovery components to discover connection(s) - *:credential-store:*:*:1.0 (optional) ICredentialStore componetns to lookup credential(s)
func InheritMessageQueue ¶
func InheritMessageQueue(overrides IMessageQueueOverrides, name string, capabilities *MessagingCapabilities) *MessageQueue
InheritMessageQueue method are creates a new instance of the message queue.
Parameters: - overrides a message queue overrides - name (optional) a queue name - capabilities (optional) capabilities of this message queue
func (*MessageQueue) BeginListen ¶
func (c *MessageQueue) BeginListen(ctx context.Context, correlationId string, receiver IMessageReceiver)
BeginListen method are listens for incoming messages without blocking the current thread.
Parameters: - ctx context.Context - correlationId (optional) transaction id to trace execution through call chain. - receiver a receiver to receive incoming messages. see Listen see IMessageReceiver
func (*MessageQueue) Capabilities ¶
func (c *MessageQueue) Capabilities() *MessagingCapabilities
Capabilities method are gets the queue capabilities
Returns: the queue's capabilities object.
func (*MessageQueue) CheckOpen ¶
func (c *MessageQueue) CheckOpen(correlationId string) error
CheckOpen if message queue has been opened
Parameters: - correlationId (optional) transaction id to trace execution through call chain. Returns: error or null for success.
func (*MessageQueue) Configure ¶
func (c *MessageQueue) Configure(ctx context.Context, config *cconf.ConfigParams)
Configure method are configures component by passing configuration parameters.
Parameters: - ctx context.Context - config configuration parameters to be set.
func (*MessageQueue) Name ¶
func (c *MessageQueue) Name() string
Name method are gets the queue name
Returns: the queue name.
func (*MessageQueue) Open ¶
func (c *MessageQueue) Open(ctx context.Context, correlationId string) error
Open method are opens the component.
Parameters: - ctx context.Context - correlationId (optional) transaction id to trace execution through call chain. Returns: error or null no errors occured.
func (*MessageQueue) OpenWithParams ¶
func (c *MessageQueue) OpenWithParams(ctx context.Context, correlationId string, connections []*cconn.ConnectionParams, credential *cauth.CredentialParams) error
OpenWithParams method are opens the component with given connection and credential parameters.
Parameters: - ctx context.Context - correlationId (optional) transaction id to trace execution through call chain. - connections is a connection parameters - credential is a credential parameters
Returns: error or nil no errors occurred.
func (*MessageQueue) SendAsObject ¶
func (c *MessageQueue) SendAsObject(ctx context.Context, correlationId string, messageType string, message any) (err error)
SendAsObject method are sends an object into the queue. Before sending the object is converted into JSON string and wrapped in a MessageEnvelop.
Parameters: - ctx context.Context - correlationId (optional) transaction id to trace execution through call chain. - messageType a message type - value an object value to be sent Returns: error or nil for success. see Send
func (*MessageQueue) SetReferences ¶
func (c *MessageQueue) SetReferences(ctx context.Context, references cref.IReferences)
SetReferences method are sets references to dependent components.
Parameters: - ctx context.Context - references is a references to locate the component dependencies.
func (*MessageQueue) String ¶
func (c *MessageQueue) String() string
String method are gets a string representation of the object.
Returns: a string representation of the object.
type MessagingCapabilities ¶
type MessagingCapabilities struct {
// contains filtered or unexported fields
}
MessagingCapabilities data object that contains supported capabilities of a message queue. If certain capability is not supported a queue will throw NotImplemented exception.
func NewMessagingCapabilities ¶
func NewMessagingCapabilities(canMessageCount bool, canSend bool, canReceive bool, canPeek bool, canPeekBatch bool, canRenewLock bool, canAbandon bool, canDeadLetter bool, canClear bool) *MessagingCapabilities
NewMessagingCapabilities method are creates a new instance of the capabilities object.
Parameters: - canMessageCount true if queue supports reading message count. - canSend true if queue is able to send messages. - canReceive true if queue is able to receive messages. - canPeek true if queue is able to peek messages. - canPeekBatch true if queue is able to peek multiple messages in one batch. - canRenewLock true if queue is able to renew message lock. - canAbandon true if queue is able to abandon messages. - canDeadLetter true if queue is able to send messages to dead letter queue. - canClear true if queue can be cleared. Returns: *MessagingCapabilities
func (*MessagingCapabilities) CanAbandon ¶
func (c *MessagingCapabilities) CanAbandon() bool
CanAbandon method are informs if the queue is able to abandon messages.
Returns: true if queue is able to abandon.
func (*MessagingCapabilities) CanClear ¶
func (c *MessagingCapabilities) CanClear() bool
CanClear method are informs if the queue can be cleared.
Returns: true if queue can be cleared.
func (*MessagingCapabilities) CanDeadLetter ¶
func (c *MessagingCapabilities) CanDeadLetter() bool
CanDeadLetter method are informs if the queue is able to send messages to dead letter queue.
Returns: true if queue is able to send messages to dead letter queue.
func (*MessagingCapabilities) CanMessageCount ¶
func (c *MessagingCapabilities) CanMessageCount() bool
CanMessageCount method are informs if the queue is able to read number of messages.
Returns: true if queue supports reading message count.
func (*MessagingCapabilities) CanPeek ¶
func (c *MessagingCapabilities) CanPeek() bool
CanPeek method are informs if the queue is able to peek messages.
Returns: true if queue is able to peek messages.
func (*MessagingCapabilities) CanPeekBatch ¶
func (c *MessagingCapabilities) CanPeekBatch() bool
CanPeekBatch method are informs if the queue is able to peek multiple messages in one batch.
Returns: true if queue is able to peek multiple messages in one batch.
func (*MessagingCapabilities) CanReceive ¶
func (c *MessagingCapabilities) CanReceive() bool
CanReceive method are informs if the queue is able to receive messages.
Returns: true if queue is able to receive messages.
func (*MessagingCapabilities) CanRenewLock ¶
func (c *MessagingCapabilities) CanRenewLock() bool
CanRenewLock method are informs if the queue is able to renew message lock.
Returns: true if queue is able to renew message lock.
func (*MessagingCapabilities) CanSend ¶
func (c *MessagingCapabilities) CanSend() bool
CanSend method are informs if the queue is able to send messages.
Returns: true if queue is able to send messages.