Documentation ¶
Index ¶
- Constants
- type BaseEntityDescription
- type DispositionAction
- type Handler
- type ListenerHandle
- type Message
- func (m *Message) Abandon() DispositionAction
- func (m *Message) Complete() DispositionAction
- func (m *Message) DeadLetter(err error) DispositionAction
- func (m *Message) DeadLetterWithInfo(err error, condition MessageErrorCondition, additionalData map[string]string) DispositionAction
- func (m *Message) ForeachKey(handler func(key, val string) error) error
- func (m *Message) Set(key, value string)
- type MessageErrorCondition
- type MessageWithContext
- type Namespace
- func (ns *Namespace) NewQueue(ctx context.Context, name string, opts ...QueueOption) (*Queue, error)
- func (ns *Namespace) NewQueueManager() *QueueManager
- func (ns *Namespace) NewSubscriptionManager(ctx context.Context, topicName string) (*SubscriptionManager, error)
- func (ns *Namespace) NewTopic(ctx context.Context, name string, opts ...TopicOption) (*Topic, error)
- func (ns *Namespace) NewTopicManager() *TopicManager
- type NamespaceOption
- type Queue
- type QueueDescription
- type QueueEntity
- type QueueManagementOption
- func QueueEntityWithAutoDeleteOnIdle(window *time.Duration) QueueManagementOption
- func QueueEntityWithDeadLetteringOnMessageExpiration() QueueManagementOption
- func QueueEntityWithDuplicateDetection(window *time.Duration) QueueManagementOption
- func QueueEntityWithLockDuration(window *time.Duration) QueueManagementOption
- func QueueEntityWithMaxDeliveryCount(count int32) QueueManagementOption
- func QueueEntityWithMaxSizeInMegabytes(size int) QueueManagementOption
- func QueueEntityWithMessageTimeToLive(window *time.Duration) QueueManagementOption
- func QueueEntityWithPartitioning() QueueManagementOption
- func QueueEntityWithRequiredSessions() QueueManagementOption
- type QueueManager
- func (qm *QueueManager) Delete(ctx context.Context, name string) error
- func (em QueueManager) Execute(ctx context.Context, method string, entityPath string, body io.Reader) (*http.Response, error)
- func (qm *QueueManager) Get(ctx context.Context, name string) (*QueueEntity, error)
- func (qm *QueueManager) List(ctx context.Context) ([]*QueueEntity, error)
- func (em QueueManager) Post(ctx context.Context, entityPath string, body []byte) (*http.Response, error)
- func (qm *QueueManager) Put(ctx context.Context, name string, opts ...QueueManagementOption) (*QueueEntity, error)
- type QueueOption
- type ReceiveMode
- type SendOption
- type Subscription
- type SubscriptionDescription
- type SubscriptionEntity
- type SubscriptionManagementOption
- func SubscriptionWithAutoDeleteOnIdle(window *time.Duration) SubscriptionManagementOption
- func SubscriptionWithBatchedOperations() SubscriptionManagementOption
- func SubscriptionWithDeadLetteringOnMessageExpiration() SubscriptionManagementOption
- func SubscriptionWithLockDuration(window *time.Duration) SubscriptionManagementOption
- func SubscriptionWithMessageTimeToLive(window *time.Duration) SubscriptionManagementOption
- func SubscriptionWithRequiredSessions() SubscriptionManagementOption
- type SubscriptionManager
- func (sm *SubscriptionManager) Delete(ctx context.Context, name string) error
- func (em SubscriptionManager) Execute(ctx context.Context, method string, entityPath string, body io.Reader) (*http.Response, error)
- func (sm *SubscriptionManager) Get(ctx context.Context, name string) (*SubscriptionEntity, error)
- func (sm *SubscriptionManager) List(ctx context.Context) ([]*SubscriptionEntity, error)
- func (em SubscriptionManager) Post(ctx context.Context, entityPath string, body []byte) (*http.Response, error)
- func (sm *SubscriptionManager) Put(ctx context.Context, name string, opts ...SubscriptionManagementOption) (*SubscriptionEntity, error)
- type SubscriptionOption
- type SystemProperties
- type Topic
- func (t *Topic) Close(ctx context.Context) error
- func (t *Topic) NewSubscription(ctx context.Context, name string, opts ...SubscriptionOption) (*Subscription, error)
- func (t *Topic) NewSubscriptionManager() *SubscriptionManager
- func (t *Topic) Send(ctx context.Context, event *Message, opts ...SendOption) error
- type TopicDescription
- type TopicEntity
- type TopicManagementOption
- func TopicWithAutoDeleteOnIdle(window *time.Duration) TopicManagementOption
- func TopicWithBatchedOperations() TopicManagementOption
- func TopicWithDuplicateDetection(window *time.Duration) TopicManagementOption
- func TopicWithExpress() TopicManagementOption
- func TopicWithMaxSizeInMegabytes(size int) TopicManagementOption
- func TopicWithMessageTimeToLive(window *time.Duration) TopicManagementOption
- func TopicWithOrdering() TopicManagementOption
- func TopicWithPartitioning() TopicManagementOption
- type TopicManager
- func (tm *TopicManager) Delete(ctx context.Context, name string) error
- func (em TopicManager) Execute(ctx context.Context, method string, entityPath string, body io.Reader) (*http.Response, error)
- func (tm *TopicManager) Get(ctx context.Context, name string) (*TopicEntity, error)
- func (tm *TopicManager) List(ctx context.Context) ([]*TopicEntity, error)
- func (em TopicManager) Post(ctx context.Context, entityPath string, body []byte) (*http.Response, error)
- func (tm *TopicManager) Put(ctx context.Context, name string, opts ...TopicManagementOption) (*TopicEntity, error)
- type TopicOption
Constants ¶
const ( // Version is the semantic version number Version = "0.0.1" // Megabytes is a helper for specifying MaxSizeInMegabytes and equals 1024, thus 5 GB is 5 * Megabytes Megabytes = 1024 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseEntityDescription ¶
type BaseEntityDescription struct { InstanceMetadataSchema *string `xml:"xmlns:i,attr,omitempty"` ServiceBusSchema *string `xml:"xmlns,attr,omitempty"` }
BaseEntityDescription provides common fields which are part of Queues, Topics and Subscriptions
type DispositionAction ¶
DispositionAction represents the action to notify Azure Service Bus of the Message's disposition
type Handler ¶
type Handler func(context.Context, *Message) DispositionAction
Handler is the function signature for any receiver of AMQP messages
type ListenerHandle ¶
type ListenerHandle struct {
// contains filtered or unexported fields
}
ListenerHandle provides the ability to close or listen to the close of a Receiver
func (*ListenerHandle) Close ¶
func (lc *ListenerHandle) Close(ctx context.Context) error
Close will close the listener
func (*ListenerHandle) Done ¶
func (lc *ListenerHandle) Done() <-chan struct{}
Done will close the channel when the listener has stopped
func (*ListenerHandle) Err ¶
func (lc *ListenerHandle) Err() error
Err will return the last error encountered
type Message ¶
type Message struct { ContentType string CorrelationID string Data []byte DeliveryCount uint32 GroupID *string GroupSequence *uint32 ID string Label string PartitionKey string ReplyTo string ReplyToGroupID string To string TTL time.Duration LockToken *string SystemProperties *SystemProperties UserProperties map[string]interface{} // contains filtered or unexported fields }
Message is an Service Bus message to be sent or received
func NewMessage ¶
NewMessage builds an Message from a slice of data
func NewMessageFromString ¶
NewMessageFromString builds an Message from a string message
func (*Message) Abandon ¶
func (m *Message) Abandon() DispositionAction
Abandon will notify Azure Service Bus the message failed but should be re-queued for delivery.
func (*Message) Complete ¶
func (m *Message) Complete() DispositionAction
Complete will notify Azure Service Bus that the message was successfully handled and should be deleted from the queue
func (*Message) DeadLetter ¶
func (m *Message) DeadLetter(err error) DispositionAction
DeadLetter will notify Azure Service Bus the message failed and should not re-queued
func (*Message) DeadLetterWithInfo ¶
func (m *Message) DeadLetterWithInfo(err error, condition MessageErrorCondition, additionalData map[string]string) DispositionAction
DeadLetterWithInfo will notify Azure Service Bus the message failed and should not be re-queued with additional context
func (*Message) ForeachKey ¶
ForeachKey implements the opentracing.TextMapReader and gets properties on the event to be propagated from the message broker
type MessageErrorCondition ¶
type MessageErrorCondition string
MessageErrorCondition represents a well-known collection of AMQP errors
const ( ErrorInternalError MessageErrorCondition = "amqp:internal-error" ErrorNotFound MessageErrorCondition = "amqp:not-found" ErrorDecodeError MessageErrorCondition = "amqp:decode-error" ErrorResourceLimitExceeded MessageErrorCondition = "amqp:resource-limit-exceeded" ErrorNotAllowed MessageErrorCondition = "amqp:not-allowed" ErrorInvalidField MessageErrorCondition = "amqp:invalid-field" ErrorNotImplemented MessageErrorCondition = "amqp:not-implemented" ErrorResourceLocked MessageErrorCondition = "amqp:resource-locked" ErrorPreconditionFailed MessageErrorCondition = "amqp:precondition-failed" ErrorResourceDeleted MessageErrorCondition = "amqp:resource-deleted" ErrorIllegalState MessageErrorCondition = "amqp:illegal-state" )
Error Conditions
type MessageWithContext ¶
MessageWithContext is a Service Bus message with its context which propagates the distributed trace information
func (*MessageWithContext) Abandon ¶
func (m *MessageWithContext) Abandon()
Abandon will notify Azure Service Bus the message failed but should be re-queued for delivery.
func (*MessageWithContext) Complete ¶
func (m *MessageWithContext) Complete()
Complete will notify Azure Service Bus that the message was successfully handled and should be deleted from the queue
func (*MessageWithContext) DeadLetter ¶
func (m *MessageWithContext) DeadLetter(err error)
DeadLetter will notify Azure Service Bus the message failed and should not re-queued
func (*MessageWithContext) DeadLetterWithInfo ¶
func (m *MessageWithContext) DeadLetterWithInfo(err error, condition MessageErrorCondition, additionalData map[string]string)
DeadLetterWithInfo will notify Azure Service Bus the message failed and should not be re-queued with additional context
type Namespace ¶
type Namespace struct { Name string TokenProvider auth.TokenProvider Environment azure.Environment }
Namespace provides a simplified facade over the AMQP implementation of Azure Service Bus and is the entry point for using Queues, Topics and Subscriptions
func NewNamespace ¶
func NewNamespace(opts ...NamespaceOption) (*Namespace, error)
NewNamespace creates a new namespace configured through NamespaceOption(s)
func (*Namespace) NewQueue ¶
func (ns *Namespace) NewQueue(ctx context.Context, name string, opts ...QueueOption) (*Queue, error)
NewQueue creates a new Queue Sender / Receiver
func (*Namespace) NewQueueManager ¶
func (ns *Namespace) NewQueueManager() *QueueManager
NewQueueManager creates a new QueueManager for a Service Bus Namespace
func (*Namespace) NewSubscriptionManager ¶
func (ns *Namespace) NewSubscriptionManager(ctx context.Context, topicName string) (*SubscriptionManager, error)
NewSubscriptionManager creates a new SubscriptionManger for a Service Bus Namespace
func (*Namespace) NewTopic ¶
func (ns *Namespace) NewTopic(ctx context.Context, name string, opts ...TopicOption) (*Topic, error)
NewTopic creates a new Topic Sender
func (*Namespace) NewTopicManager ¶
func (ns *Namespace) NewTopicManager() *TopicManager
NewTopicManager creates a new TopicManager for a Service Bus Namespace
type NamespaceOption ¶
NamespaceOption provides structure for configuring a new Service Bus namespace
func NamespaceWithConnectionString ¶
func NamespaceWithConnectionString(connStr string) NamespaceOption
NamespaceWithConnectionString configures a namespace with the information provided in a Service Bus connection string
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents a Service Bus Queue entity, which offers First In, First Out (FIFO) message delivery to one or more competing consumers. That is, messages are typically expected to be received and processed by the receivers in the order in which they were added to the queue, and each message is received and processed by only one message consumer.
func (*Queue) ReceiveOne ¶
func (q *Queue) ReceiveOne(ctx context.Context) (*MessageWithContext, error)
ReceiveOne will listen to receive a single message. ReceiveOne will only wait as long as the context allows.
type QueueDescription ¶
type QueueDescription struct { XMLName xml.Name `xml:"QueueDescription"` BaseEntityDescription LockDuration *string `xml:"LockDuration,omitempty"` // LockDuration - ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. MaxSizeInMegabytes *int32 `xml:"MaxSizeInMegabytes,omitempty"` // MaxSizeInMegabytes - The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024. RequiresDuplicateDetection *bool `xml:"RequiresDuplicateDetection,omitempty"` // RequiresDuplicateDetection - A value indicating if this queue requires duplicate detection. RequiresSession *bool `xml:"RequiresSession,omitempty"` DefaultMessageTimeToLive *string `xml:"DefaultMessageTimeToLive,omitempty"` // DefaultMessageTimeToLive - ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. DeadLetteringOnMessageExpiration *bool `xml:"DeadLetteringOnMessageExpiration,omitempty"` // DeadLetteringOnMessageExpiration - A value that indicates whether this queue has dead letter support when a message expires. DuplicateDetectionHistoryTimeWindow *string `xml:"DuplicateDetectionHistoryTimeWindow,omitempty"` // DuplicateDetectionHistoryTimeWindow - ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. MaxDeliveryCount *int32 `xml:"MaxDeliveryCount,omitempty"` // MaxDeliveryCount - The maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10. EnableBatchedOperations *bool `xml:"EnableBatchedOperations,omitempty"` // EnableBatchedOperations - Value that indicates whether server-side batched operations are enabled. SizeInBytes *int64 `xml:"SizeInBytes,omitempty"` // SizeInBytes - The size of the queue, in bytes. MessageCount *int64 `xml:"MessageCount,omitempty"` // MessageCount - The number of messages in the queue. IsAnonymousAccessible *bool `xml:"IsAnonymousAccessible,omitempty"` Status *servicebus.EntityStatus `xml:"Status,omitempty"` CreatedAt *date.Time `xml:"CreatedAt,omitempty"` UpdatedAt *date.Time `xml:"UpdatedAt,omitempty"` SupportOrdering *bool `xml:"SupportOrdering,omitempty"` AutoDeleteOnIdle *string `xml:"AutoDeleteOnIdle,omitempty"` EnablePartitioning *bool `xml:"EnablePartitioning,omitempty"` EnableExpress *bool `xml:"EnableExpress,omitempty"` }
QueueDescription is the content type for Queue management requests
type QueueEntity ¶
type QueueEntity struct { *QueueDescription Name string }
QueueEntity is the Azure Service Bus description of a Queue for management activities
type QueueManagementOption ¶
type QueueManagementOption func(*QueueDescription) error
QueueManagementOption represents named configuration options for queue mutation
func QueueEntityWithAutoDeleteOnIdle ¶
func QueueEntityWithAutoDeleteOnIdle(window *time.Duration) QueueManagementOption
QueueEntityWithAutoDeleteOnIdle configures the queue to automatically delete after the specified idle interval. The minimum duration is 5 minutes.
func QueueEntityWithDeadLetteringOnMessageExpiration ¶
func QueueEntityWithDeadLetteringOnMessageExpiration() QueueManagementOption
QueueEntityWithDeadLetteringOnMessageExpiration will ensure the queue sends expired messages to the dead letter queue
func QueueEntityWithDuplicateDetection ¶
func QueueEntityWithDuplicateDetection(window *time.Duration) QueueManagementOption
QueueEntityWithDuplicateDetection configures the queue to detect duplicates for a given time window. If window is not specified, then it uses the default of 10 minutes.
func QueueEntityWithLockDuration ¶
func QueueEntityWithLockDuration(window *time.Duration) QueueManagementOption
QueueEntityWithLockDuration configures the queue to have a duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute.
func QueueEntityWithMaxDeliveryCount ¶
func QueueEntityWithMaxDeliveryCount(count int32) QueueManagementOption
QueueEntityWithMaxDeliveryCount configures the queue to have a maximum number of delivery attempts before dead-lettering the message
func QueueEntityWithMaxSizeInMegabytes ¶
func QueueEntityWithMaxSizeInMegabytes(size int) QueueManagementOption
QueueEntityWithMaxSizeInMegabytes configures the maximum size of the queue in megabytes (1 * 1024 - 5 * 1024), which is the size of the memory allocated for the queue. Default is 1 MB (1 * 1024).
func QueueEntityWithMessageTimeToLive ¶
func QueueEntityWithMessageTimeToLive(window *time.Duration) QueueManagementOption
QueueEntityWithMessageTimeToLive configures the queue to set a time to live on messages. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. If nil, defaults to 14 days.
func QueueEntityWithPartitioning ¶
func QueueEntityWithPartitioning() QueueManagementOption
QueueEntityWithPartitioning ensure the created queue will be a partitioned queue. Partitioned queues offer increased storage and availability compared to non-partitioned queues with the trade-off of requiring the following to ensure FIFO message retrieval:
SessionId. If a message has the SessionId property set, then Service Bus uses the SessionId property as the partition key. This way, all messages that belong to the same session are assigned to the same fragment and handled by the same message broker. This allows Service Bus to guarantee message ordering as well as the consistency of session states.
PartitionKey. If a message has the PartitionKey property set but not the SessionId property, then Service Bus uses the PartitionKey property as the partition key. Use the PartitionKey property to send non-sessionful transactional messages. The partition key ensures that all messages that are sent within a transaction are handled by the same messaging broker.
MessageId. If the queue has the RequiresDuplicationDetection property set to true, then the MessageId property serves as the partition key if the SessionId or a PartitionKey properties are not set. This ensures that all copies of the same message are handled by the same message broker and, thus, allows Service Bus to detect and eliminate duplicate messages
func QueueEntityWithRequiredSessions ¶
func QueueEntityWithRequiredSessions() QueueManagementOption
QueueEntityWithRequiredSessions will ensure the queue requires senders and receivers to have sessionIDs
type QueueManager ¶
type QueueManager struct {
// contains filtered or unexported fields
}
QueueManager provides CRUD functionality for Service Bus Queues
func (*QueueManager) Delete ¶
func (qm *QueueManager) Delete(ctx context.Context, name string) error
Delete deletes a Service Bus Queue entity by name
func (QueueManager) Execute ¶
func (em QueueManager) Execute(ctx context.Context, method string, entityPath string, body io.Reader) (*http.Response, error)
Execute performs an HTTP request given a http method, path and body
func (*QueueManager) Get ¶
func (qm *QueueManager) Get(ctx context.Context, name string) (*QueueEntity, error)
Get fetches a Service Bus Queue entity by name
func (*QueueManager) List ¶
func (qm *QueueManager) List(ctx context.Context) ([]*QueueEntity, error)
List fetches all of the queues for a Service Bus Namespace
func (QueueManager) Post ¶
func (em QueueManager) Post(ctx context.Context, entityPath string, body []byte) (*http.Response, error)
Post performs an HTTP POST for a given entity path and body
func (*QueueManager) Put ¶
func (qm *QueueManager) Put(ctx context.Context, name string, opts ...QueueManagementOption) (*QueueEntity, error)
Put creates or updates a Service Bus Queue
type QueueOption ¶
QueueOption represents named options for assisting Queue message handling
func QueueWithReceiveAndDelete ¶
func QueueWithReceiveAndDelete() QueueOption
QueueWithReceiveAndDelete configures a queue to pop and delete messages off of the queue upon receiving the message. This differs from the default, PeekLock, where PeekLock receives a message, locks it for a period of time, then sends a disposition to the broker when the message has been processed.
type ReceiveMode ¶
type ReceiveMode int
ReceiveMode represents the behavior when consuming a message from a queue
const ( // PeekLockMode causes a receiver to peek at a message, lock it so no others can consume and have the queue wait for // the DispositionAction PeekLockMode ReceiveMode = 0 // ReceiveAndDeleteMode causes a receiver to pop messages off of the queue without waiting for DispositionAction ReceiveAndDeleteMode ReceiveMode = 1 )
type SendOption ¶
SendOption provides a way to customize a message on sending
type Subscription ¶
type Subscription struct { Topic *Topic // contains filtered or unexported fields }
Subscription represents a Service Bus Subscription entity which are used to receive topic messages. A topic subscription resembles a virtual queue that receives copies of the messages that are sent to the topic. Messages are received from a subscription identically to the way they are received from a queue.
func (*Subscription) Close ¶
func (s *Subscription) Close(ctx context.Context) error
Close the underlying connection to Service Bus
func (*Subscription) Receive ¶
func (s *Subscription) Receive(ctx context.Context, handler Handler) (*ListenerHandle, error)
Receive subscribes for messages sent to the Subscription
func (*Subscription) ReceiveOne ¶
func (s *Subscription) ReceiveOne(ctx context.Context) (*MessageWithContext, error)
ReceiveOne will listen to receive a single message. ReceiveOne will only wait as long as the context allows.
type SubscriptionDescription ¶
type SubscriptionDescription struct { XMLName xml.Name `xml:"SubscriptionDescription"` BaseEntityDescription LockDuration *string `xml:"LockDuration,omitempty"` // LockDuration - ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. RequiresSession *bool `xml:"RequiresSession,omitempty"` DefaultMessageTimeToLive *string `xml:"DefaultMessageTimeToLive,omitempty"` // DefaultMessageTimeToLive - ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. DeadLetteringOnMessageExpiration *bool `xml:"DeadLetteringOnMessageExpiration,omitempty"` // DeadLetteringOnMessageExpiration - A value that indicates whether this queue has dead letter support when a message expires. DeadLetteringOnFilterEvaluationExceptions *bool `xml:"DeadLetteringOnFilterEvaluationExceptions,omitempty"` MessageCount *int64 `xml:"MessageCount,omitempty"` // MessageCount - The number of messages in the queue. MaxDeliveryCount *int32 `xml:"MaxDeliveryCount,omitempty"` // MaxDeliveryCount - The maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10. EnableBatchedOperations *bool `xml:"EnableBatchedOperations,omitempty"` // EnableBatchedOperations - Value that indicates whether server-side batched operations are enabled. Status *servicebus.EntityStatus `xml:"Status,omitempty"` CreatedAt *date.Time `xml:"CreatedAt,omitempty"` UpdatedAt *date.Time `xml:"UpdatedAt,omitempty"` AccessedAt *date.Time `xml:"AccessedAt,omitempty"` AutoDeleteOnIdle *string `xml:"AutoDeleteOnIdle,omitempty"` }
SubscriptionDescription is the content type for Subscription management requests
type SubscriptionEntity ¶
type SubscriptionEntity struct { *SubscriptionDescription Name string }
SubscriptionEntity is the Azure Service Bus description of a topic Subscription for management activities
type SubscriptionManagementOption ¶
type SubscriptionManagementOption func(*SubscriptionDescription) error
SubscriptionManagementOption represents named options for assisting Subscription creation
func SubscriptionWithAutoDeleteOnIdle ¶
func SubscriptionWithAutoDeleteOnIdle(window *time.Duration) SubscriptionManagementOption
SubscriptionWithAutoDeleteOnIdle configures the subscription to automatically delete after the specified idle interval. The minimum duration is 5 minutes.
func SubscriptionWithBatchedOperations ¶
func SubscriptionWithBatchedOperations() SubscriptionManagementOption
SubscriptionWithBatchedOperations configures the subscription to batch server-side operations.
func SubscriptionWithDeadLetteringOnMessageExpiration ¶
func SubscriptionWithDeadLetteringOnMessageExpiration() SubscriptionManagementOption
SubscriptionWithDeadLetteringOnMessageExpiration will ensure the Subscription sends expired messages to the dead letter queue
func SubscriptionWithLockDuration ¶
func SubscriptionWithLockDuration(window *time.Duration) SubscriptionManagementOption
SubscriptionWithLockDuration configures the subscription to have a duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute.
func SubscriptionWithMessageTimeToLive ¶
func SubscriptionWithMessageTimeToLive(window *time.Duration) SubscriptionManagementOption
SubscriptionWithMessageTimeToLive configures the subscription to set a time to live on messages. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. If nil, defaults to 14 days.
func SubscriptionWithRequiredSessions ¶
func SubscriptionWithRequiredSessions() SubscriptionManagementOption
SubscriptionWithRequiredSessions will ensure the subscription requires senders and receivers to have sessionIDs
type SubscriptionManager ¶
type SubscriptionManager struct { Topic *Topic // contains filtered or unexported fields }
SubscriptionManager provides CRUD functionality for Service Bus Subscription
func (*SubscriptionManager) Delete ¶
func (sm *SubscriptionManager) Delete(ctx context.Context, name string) error
Delete deletes a Service Bus Topic entity by name
func (SubscriptionManager) Execute ¶
func (em SubscriptionManager) Execute(ctx context.Context, method string, entityPath string, body io.Reader) (*http.Response, error)
Execute performs an HTTP request given a http method, path and body
func (*SubscriptionManager) Get ¶
func (sm *SubscriptionManager) Get(ctx context.Context, name string) (*SubscriptionEntity, error)
Get fetches a Service Bus Topic entity by name
func (*SubscriptionManager) List ¶
func (sm *SubscriptionManager) List(ctx context.Context) ([]*SubscriptionEntity, error)
List fetches all of the Topics for a Service Bus Namespace
func (SubscriptionManager) Post ¶
func (em SubscriptionManager) Post(ctx context.Context, entityPath string, body []byte) (*http.Response, error)
Post performs an HTTP POST for a given entity path and body
func (*SubscriptionManager) Put ¶
func (sm *SubscriptionManager) Put(ctx context.Context, name string, opts ...SubscriptionManagementOption) (*SubscriptionEntity, error)
Put creates or updates a Service Bus Topic
type SubscriptionOption ¶
type SubscriptionOption func(*Subscription) error
SubscriptionOption configures the Subscription Azure Service Bus client
func SubscriptionWithReceiveAndDelete ¶
func SubscriptionWithReceiveAndDelete() SubscriptionOption
SubscriptionWithReceiveAndDelete configures a subscription to pop and delete messages off of the queue upon receiving the message. This differs from the default, PeekLock, where PeekLock receives a message, locks it for a period of time, then sends a disposition to the broker when the message has been processed.
type SystemProperties ¶
type SystemProperties struct { LockedUntil *time.Time `mapstructure:"x-opt-locked-until"` SequenceNumber *int64 `mapstructure:"x-opt-sequence-number"` PartitionID *int16 `mapstructure:"x-opt-partition-id"` PartitionKey *string `mapstructure:"x-opt-partition-key"` EnqueuedTime *time.Time `mapstructure:"x-opt-enqueued-time"` DeadLetterSource *string `mapstructure:"x-opt-deadletter-source"` ScheduledEnqueuedTime *time.Time `mapstructure:"x-opt-scheduled-enqueued-time"` EnqueuedSequenceNumber *int64 `mapstructure:"x-opt-enqueue-sequence-number"` ViaPartitionKey *string `mapstructure:"x-opt-via-partition-key"` }
SystemProperties are used to store properties that are set by the system.
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
Topic in contrast to queues, in which each message is processed by a single consumer, topics and subscriptions provide a one-to-many form of communication, in a publish/subscribe pattern. Useful for scaling to very large numbers of recipients, each published message is made available to each subscription registered with the topic. Messages are sent to a topic and delivered to one or more associated subscriptions, depending on filter rules that can be set on a per-subscription basis. The subscriptions can use additional filters to restrict the messages that they want to receive. Messages are sent to a topic in the same way they are sent to a queue, but messages are not received from the topic directly. Instead, they are received from subscriptions. A topic subscription resembles a virtual queue that receives copies of the messages that are sent to the topic. Messages are received from a subscription identically to the way they are received from a queue.
func (*Topic) NewSubscription ¶
func (t *Topic) NewSubscription(ctx context.Context, name string, opts ...SubscriptionOption) (*Subscription, error)
NewSubscription creates a new Topic Subscription client
func (*Topic) NewSubscriptionManager ¶
func (t *Topic) NewSubscriptionManager() *SubscriptionManager
NewSubscriptionManager creates a new SubscriptionManager for a Service Bus Topic
type TopicDescription ¶
type TopicDescription struct { XMLName xml.Name `xml:"TopicDescription"` BaseEntityDescription DefaultMessageTimeToLive *string `xml:"DefaultMessageTimeToLive,omitempty"` // DefaultMessageTimeToLive - ISO 8601 default message time span to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. MaxSizeInMegabytes *int32 `xml:"MaxSizeInMegabytes,omitempty"` // MaxSizeInMegabytes - The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024. RequiresDuplicateDetection *bool `xml:"RequiresDuplicateDetection,omitempty"` // RequiresDuplicateDetection - A value indicating if this queue requires duplicate detection. DuplicateDetectionHistoryTimeWindow *string `xml:"DuplicateDetectionHistoryTimeWindow,omitempty"` // DuplicateDetectionHistoryTimeWindow - ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. EnableBatchedOperations *bool `xml:"EnableBatchedOperations,omitempty"` // EnableBatchedOperations - Value that indicates whether server-side batched operations are enabled. SizeInBytes *int64 `xml:"SizeInBytes,omitempty"` // SizeInBytes - The size of the queue, in bytes. FilteringMessagesBeforePublishing *bool `xml:"FilteringMessagesBeforePublishing,omitempty"` IsAnonymousAccessible *bool `xml:"IsAnonymousAccessible,omitempty"` Status *servicebus.EntityStatus `xml:"Status,omitempty"` CreatedAt *date.Time `xml:"CreatedAt,omitempty"` UpdatedAt *date.Time `xml:"UpdatedAt,omitempty"` SupportOrdering *bool `xml:"SupportOrdering,omitempty"` AutoDeleteOnIdle *string `xml:"AutoDeleteOnIdle,omitempty"` EnablePartitioning *bool `xml:"EnablePartitioning,omitempty"` EnableSubscriptionPartitioning *bool `xml:"EnableSubscriptionPartitioning,omitempty"` EnableExpress *bool `xml:"EnableExpress,omitempty"` }
TopicDescription is the content type for Topic management requests
type TopicEntity ¶
type TopicEntity struct { *TopicDescription Name string }
TopicEntity is the Azure Service Bus description of a Topic for management activities
type TopicManagementOption ¶
type TopicManagementOption func(*TopicDescription) error
TopicManagementOption represents named options for assisting Topic creation
func TopicWithAutoDeleteOnIdle ¶
func TopicWithAutoDeleteOnIdle(window *time.Duration) TopicManagementOption
TopicWithAutoDeleteOnIdle configures the topic to automatically delete after the specified idle interval. The minimum duration is 5 minutes.
func TopicWithBatchedOperations ¶
func TopicWithBatchedOperations() TopicManagementOption
TopicWithBatchedOperations configures the topic to batch server-side operations.
func TopicWithDuplicateDetection ¶
func TopicWithDuplicateDetection(window *time.Duration) TopicManagementOption
TopicWithDuplicateDetection configures the topic to detect duplicates for a given time window. If window is not specified, then it uses the default of 10 minutes.
func TopicWithExpress ¶
func TopicWithExpress() TopicManagementOption
TopicWithExpress configures the topic to hold a message in memory temporarily before writing it to persistent storage.
func TopicWithMaxSizeInMegabytes ¶
func TopicWithMaxSizeInMegabytes(size int) TopicManagementOption
TopicWithMaxSizeInMegabytes configures the maximum size of the topic in megabytes (1 * 1024 - 5 * 1024), which is the size of the memory allocated for the topic. Default is 1 MB (1 * 1024).
func TopicWithMessageTimeToLive ¶
func TopicWithMessageTimeToLive(window *time.Duration) TopicManagementOption
TopicWithMessageTimeToLive configures the topic to set a time to live on messages. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. If nil, defaults to 14 days.
func TopicWithOrdering ¶
func TopicWithOrdering() TopicManagementOption
TopicWithOrdering configures the topic to support ordering of messages.
func TopicWithPartitioning ¶
func TopicWithPartitioning() TopicManagementOption
TopicWithPartitioning configures the topic to be partitioned across multiple message brokers.
type TopicManager ¶
type TopicManager struct {
// contains filtered or unexported fields
}
TopicManager provides CRUD functionality for Service Bus Topics
func (*TopicManager) Delete ¶
func (tm *TopicManager) Delete(ctx context.Context, name string) error
Delete deletes a Service Bus Topic entity by name
func (TopicManager) Execute ¶
func (em TopicManager) Execute(ctx context.Context, method string, entityPath string, body io.Reader) (*http.Response, error)
Execute performs an HTTP request given a http method, path and body
func (*TopicManager) Get ¶
func (tm *TopicManager) Get(ctx context.Context, name string) (*TopicEntity, error)
Get fetches a Service Bus Topic entity by name
func (*TopicManager) List ¶
func (tm *TopicManager) List(ctx context.Context) ([]*TopicEntity, error)
List fetches all of the Topics for a Service Bus Namespace
func (TopicManager) Post ¶
func (em TopicManager) Post(ctx context.Context, entityPath string, body []byte) (*http.Response, error)
Post performs an HTTP POST for a given entity path and body
func (*TopicManager) Put ¶
func (tm *TopicManager) Put(ctx context.Context, name string, opts ...TopicManagementOption) (*TopicEntity, error)
Put creates or updates a Service Bus Topic
type TopicOption ¶
TopicOption represents named options for assisting Topic message handling