Documentation ¶
Index ¶
- Constants
- type AckMessage
- type BindRequest
- type Client
- type Codec
- type DeliveryType
- type Message
- type MessageDesc
- type MessageId
- type MessageReleasing
- type NewMessageRequest
- type NewMessageRes
- type NewPublishGroupRequest
- type NewQueueRequest
- type NewSubscribeGroupRequest
- type NewTopicRequest
- type PublishGroup
- type PublishGroupRes
- type QueueOption
- type ReleaseMessage
- type Reply
- type RpcHandler
- type RpcStub
- type ServerSideIncoming
- type Session
- func (c *Session) BindTopicAndQueue(topic, queue, bindingKey string) error
- func (c *Session) Close(ctx context.Context) error
- func (c *Session) CreatePublishGroup(publishGroupName, topic string) (PublishGroup, error)
- func (c *Session) CreateQueue(queue string, queueOption QueueOption) error
- func (c *Session) CreateRpcStub(methodTopic, bindingKey, publishGroup string, encoder Codec) RpcStub
- func (c *Session) CreateSubscribeGroup(subscribeGroup, queue string, newSub Subscribe) error
- func (c *Session) CreateTopic(topic string, topicOption TopicOption) error
- func (c *Session) RpcHandle(serviceQueue, subscribeGroup string, encoder Codec, h RpcHandler) error
- type SimpleRpcHandler
- type Subscribe
- type SubscribeGroup
- type SubscribeGroupRes
- type ToServerSidePacket
- type TopicOption
Constants ¶
View Source
const ( DeliveryTypeAtMostOnce = "at_most_once" DeliveryTypeAtLeastOnce = "at_least_once" DeliveryTypeExactlyOnce = "exactly_once" )
View Source
const ( OperationNewTopic = "new_topic" OperationNewQueue = "new_queue" OperationBind = "bind" OperationNewPublishGroup = "new_publish_group" OperationNewSubscribeGroup = "new_subscribe_group" OperationNewMessage = "new_message" OperationAckMessage = "ack_message" OperationNewMessageCommit = "new_message_commit" OperationReleaseMessage = "release_message" )
View Source
const ( IncomingOperationMessage = "message" IncomingOperationMessageReleasing = "message_releasing" IncomingOperationReply = "reply" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AckMessage ¶
type BindRequest ¶
type DeliveryType ¶
type DeliveryType int
const ( AtMostOnce DeliveryType = 1 AtLeastOnce DeliveryType = 2 ExactlyOnce DeliveryType = 3 )
type Message ¶
type Message struct { Topic string `json:"topic"` Queue string `json:"queue"` BindingKey string `json:"binding_key"` SubscribeGroup string `json:"subscribe_group"` MessageId idgen.IdType `json:"message_id"` Payload []byte `json:"payload"` ReplyId string `json:"reply_id"` ReplyIdentifier string `json:"reply_identifier"` // contains filtered or unexported fields }
type MessageDesc ¶
type MessageReleasing ¶
type MessageReleasing struct { Topic string `json:"topic"` Queue string `json:"queue"` BindingKey string `json:"binding_key"` SubscribeGroup string `json:"subscribe_group"` MessageId idgen.IdType `json:"message_id"` ReplyId string `json:"reply_id"` ReplyIdentifier string `json:"reply_identifier"` // contains filtered or unexported fields }
type NewMessageRequest ¶
type NewMessageRes ¶
type NewPublishGroupRequest ¶
type NewQueueRequest ¶
type NewTopicRequest ¶
type PublishGroup ¶
type PublishGroup interface { // Publish for publishing message in at most once & at least once modes Publish(payload []byte, bindingKey string) (*MessageDesc, error) // CommitPublish for committing message at delivery level type of exactly-once CommitPublish(desc *MessageDesc) error }
type PublishGroupRes ¶
type PublishGroupRes struct {
PublishGroup string `json:"publish_group"`
}
type QueueOption ¶
type QueueOption struct {
DeliveryLevelType DeliveryType
}
type ReleaseMessage ¶
type RpcHandler ¶
type RpcHandler interface {
Handle(req interface{}) (interface{}, error)
}
type ServerSideIncoming ¶
type ServerSideIncoming struct { Status string `json:"status"` Info string `json:"info"` RequestId string `json:"request_id"` PublishGroupResponse *PublishGroupRes `json:"publish_group_res,omitempty"` SubscribeGroupResponse *SubscribeGroupRes `json:"subscribe_group_res,omitempty"` NewMessageResponse *NewMessageRes `json:"new_message,omitempty"` IncomingOperation *string `json:"operation,omitempty"` Message *Message `json:"message,omitempty"` MessageReleasing *MessageReleasing `json:"message_releasing,omitempty"` Reply *Reply `json:"reply,omitempty"` }
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) BindTopicAndQueue ¶
func (*Session) CreatePublishGroup ¶
func (c *Session) CreatePublishGroup(publishGroupName, topic string) (PublishGroup, error)
func (*Session) CreateQueue ¶
func (c *Session) CreateQueue(queue string, queueOption QueueOption) error
func (*Session) CreateRpcStub ¶
func (*Session) CreateSubscribeGroup ¶
CreateSubscribeGroup bind the subscribeGroup to the queue and create/reuse subscribe callback Note: for the same subscribeGroup, only the earliest subscribe will be registered
func (*Session) CreateTopic ¶
func (c *Session) CreateTopic(topic string, topicOption TopicOption) error
type SimpleRpcHandler ¶
type SimpleRpcHandler struct {
H func(req interface{}) (interface{}, error)
}
func (*SimpleRpcHandler) Handle ¶
func (s *SimpleRpcHandler) Handle(req interface{}) (interface{}, error)
type Subscribe ¶
type Subscribe interface { OnMessage(message *Message, sg SubscribeGroup) error OnReleasing(messageMeta *MessageReleasing, sg SubscribeGroup) error }
type SubscribeGroup ¶
type SubscribeGroup interface { Commit(message *Message) error Release(messageMeta *MessageReleasing) error }
type SubscribeGroupRes ¶
type SubscribeGroupRes struct {
SubscribeGroup string `json:"subscribe_group"`
}
type ToServerSidePacket ¶
type ToServerSidePacket struct { Operation string `json:"operation"` RequestId string `json:"request_id"` NewTopic *NewTopicRequest `json:"new_topic,omitempty"` NewQueue *NewQueueRequest `json:"new_queue,omitempty"` NewBinding *BindRequest `json:"new_binding,omitempty"` NewPublishGroupRequest *NewPublishGroupRequest `json:"new_publish_group,omitempty"` NewSubscribeGroupRequest *NewSubscribeGroupRequest `json:"new_subscribe_group,omitempty"` NewMessageRequest *NewMessageRequest `json:"new_message,omitempty"` NewAckMessage *AckMessage `json:"ack_message,omitempty"` NewMessageCommitRequest *MessageDesc `json:"new_message_commit,omitempty"` NewReleaseMessage *ReleaseMessage `json:"release_message,omitempty"` }
type TopicOption ¶
type TopicOption struct {
DeliveryLevelType DeliveryType
}
Click to show internal directories.
Click to hide internal directories.