Go
Last updated
Last updated
The KubeMQ SDK for Go enables Go developers to seamlessly communicate with the KubeMQ server, implementing various communication patterns such as Events, EventStore, Commands, Queries, and Queues.
https://github.com/kubemq-io/kubemq-go/tree/master/examples
Go SDK 1.17 higher
KubeMQ server running locally or accessible over the network
The examples are standalone projects that showcase the usage of the SDK. To run the examples, ensure you have a running instance of KubeMQ.
The SDK implements all communication patterns available through the KubeMQ server:
PubSub
Events
EventStore
Commands & Queries (CQ)
Commands
Queries
Queues
Create a new Events channel.
Delete an existing Events channel.
Retrieve a list of Events channels.
Returns a list where each PubSubChannel
has the following attributes:
Sends a message to an Events channel.
Event
EventsSubscription
Create a new Events Store channel.
Delete an existing Events Store channel.
Retrieve a list of Events channels.
Returns a list where each PubSubChannel
has the following attributes:
Sends a message to an Events channel.
Event
EventsStoreSubscription
Create a new Command channel.
Delete an existing Command channel.
Retrieve a list of Command channels.
Returns a list where each CQChannel
has the following attributes:
Sends a command request to a Command channel.
CommandMessage
CommandResponseMessage
CommandsSubscription
Create a new Query channel.
Delete an existing Query channel.
Retrieve a list of Query channels.
Returns a list where each CQChannel
has the following attributes:
Sends a query request to a Query channel.
QueryMessage
QueryResponse
QuerySubscription
Create a new Queue channel.
Delete an existing Queue channel.
Retrieve a list of Queue channels.
Returns a list where each QueuesChannel
has the following attributes:
Send and receive messages from a Queue channel.
QueueMessage
SendResult
PollRequest
PollResponse
Response: QueueMessage
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Type | Value | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description | Default Value | Mandatory |
---|---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Ctx
context
The context for the request.
None
Yes
ChannelName
String
Name of the channel you want to create
None
Yes
Err
error
Error message if any
ChannelName
String
Name of the channel you want to delete
None
Yes
Err
error
Error message if any
SearchQuery
String
Search query to filter channels (optional)
None
No
Name
String
The name of the Pub/Sub channel.
Type
String
The type of the Pub/Sub channel.
LastActivity
long
The timestamp of the last activity on the channel, represented in milliseconds since epoch.
IsActive
boolean
Indicates whether the channel is active or not.
Incoming
PubSubStats
The statistics related to incoming messages for this channel.
Outgoing
PubSubStats
The statistics related to outgoing messages for this channel.
Id
String
Unique identifier for the event message.
None
No
Channel
String
The channel to which the event message is sent.
None
Yes
Metadata
String
Metadata associated with the event message.
None
No
Body
byte[]
Body of the event message in bytes.
Empty byte array
No
Tags
Map<String, String>
Tags associated with the event message as key-value pairs.
Empty Map
No
Err
error
Error message if any
Channel
String
The channel to subscribe to.
None
Yes
Group
String
The group to subscribe with.
None
No
Ctx
context
The context for the request.
None
Yes
ChannelName
String
Name of the channel you want to create
None
Yes
Err
error
Error message if any
ChannelName
String
Name of the channel you want to delete
None
Yes
Err
error
Error message if any
SearchQuery
String
Search query to filter channels (optional)
None
No
Name
String
The name of the Pub/Sub channel.
Type
String
The type of the Pub/Sub channel.
LastActivity
long
The timestamp of the last activity on the channel, represented in milliseconds since epoch.
IsActive
boolean
Indicates whether the channel is active or not.
Incoming
PubSubStats
The statistics related to incoming messages for this channel.
Outgoing
PubSubStats
The statistics related to outgoing messages for this channel.
Id
String
Unique identifier for the event message.
None
No
Channel
String
The channel to which the event message is sent.
None
Yes
Metadata
String
Metadata associated with the event message.
None
No
Body
byte[]
Body of the event message in bytes.
Empty byte array
No
Tags
Map<String, String>
Tags associated with the event message as key-value pairs.
Empty Map
No
Err
error
Error message if any
Channel
String
The channel to subscribe to.
None
Yes
Group
String
The group to subscribe with.
None
No
SubscriptionType
EventsStoreSubscription
The Subscription
None
Yes
StartNewOnly
1
Start storing events from the point when the subscription is made
StartFromFirst
2
Start storing events from the first event available
StartFromLast
3
Start storing events from the last event available
StartAtSequence
4
Start storing events from a specific sequence number
StartAtTime
5
Start storing events from a specific point in time
StartAtTimeDelta
6
Start storing events from a specific time delta in seconds
Ctx
context
The context for the request.
None
Yes
ChannelName
String
Name of the channel you want to create
None
Yes
Err
error
Error message if any
ChannelName
String
Name of the channel you want to delete
None
Yes
Err
error
Error message if any
SearchQuery
String
Search query to filter channels (optional)
None
No
Name
String
The name of the Pub/Sub channel.
Type
String
The type of the Pub/Sub channel.
LastActivity
long
The timestamp of the last activity on the channel, represented in milliseconds since epoch.
IsActive
boolean
Indicates whether the channel is active or not.
Incoming
PubSubStats
The statistics related to incoming messages for this channel.
Outgoing
PubSubStats
The statistics related to outgoing messages for this channel.
Id
String
The ID of the command message.
None
Yes
Channel
String
The channel through which the command message will be sent.
None
Yes
Metadata
String
Additional metadata associated with the command message.
None
No
Body
byte[]
The body of the command message as bytes.
Empty byte array
No
Tags
Map<String, String>
A dictionary of key-value pairs representing tags associated with the command message.
Empty Map
No
Timeout
Duration
The maximum time duration for waiting to response.
None
Yes
CommandId
String
Command Id
ResponseClientId
String
The client ID associated with the command response.
Executed
boolean
Indicates if the command has been executed.
ExecutedAt
time
The timestamp when the command response was created.
Error
String
The error message if there was an error.
Channel
String
The channel for the subscription.
None
Yes
Group
String
The group associated with the subscription.
None
No
Ctx
context
The context for the request.
None
Yes
ChannelName
String
Name of the channel you want to create
None
Yes
Err
error
Error message if any
ChannelName
String
Name of the channel you want to delete
None
Yes
Err
error
Error message if any
SearchQuery
String
Search query to filter channels (optional)
None
No
Name
String
The name of the Pub/Sub channel.
Type
String
The type of the Pub/Sub channel.
LastActivity
long
The timestamp of the last activity on the channel, represented in milliseconds since epoch.
IsActive
boolean
Indicates whether the channel is active or not.
Incoming
PubSubStats
The statistics related to incoming messages for this channel.
Outgoing
PubSubStats
The statistics related to outgoing messages for this channel.
Id
String
The ID of the query message.
None
Yes
Channel
String
The channel through which the query message will be sent.
None
Yes
Metadata
String
Additional metadata associated with the query message.
None
No
Body
byte[]
The body of the query message as bytes.
Empty byte array
No
Tags
Map<String, String>
A dictionary of key-value pairs representing tags associated with the query message.
Empty Map
No
Timeout
Duration
The maximum time duration for waiting to response.
None
Yes
QueryId
String
Query Id
ResponseClientId
String
The client ID associated with the query response.
Executed
boolean
Indicates if the query has been executed.
Metadata
String
Additional metadata associated with the query response message.
Body
byte[]
The body of the query response message as bytes.
Tags
Map<String, String>
A dictionary of key-value pairs representing tags associated with the query response message.
ExecutedAt
time
The timestamp when the query response was created.
Error
String
The error message if there was an error.
Channel
String
The channel for the subscription.
None
Yes
Group
String
The group associated with the subscription.
None
No
Ctx
context
The context for the request.
None
Yes
ChannelName
String
Name of the channel you want to create
None
Yes
Err
error
Error message if any
ChannelName
String
Name of the channel you want to delete
None
Yes
Err
error
Error message if any
SearchQuery
String
Search query to filter channels (optional)
None
No
Name
String
The name of the Pub/Sub channel.
Type
String
The type of the Pub/Sub channel.
LastActivity
long
The timestamp of the last activity on the channel, represented in milliseconds since epoch.
IsActive
boolean
Indicates whether the channel is active or not.
Incoming
PubSubStats
The statistics related to incoming messages for this channel.
Outgoing
PubSubStats
The statistics related to outgoing messages for this channel.
Id
String
The unique identifier for the message.
None
No
Channel
String
The channel of the message.
None
Yes
Metadata
String
The metadata associated with the message.
None
No
Body
byte[]
The body of the message.
new byte[0]
No
Tags
Map<String, String>
The tags associated with the message.
new HashMap<>()
No
PolicyDelaySeconds
int
The delay in seconds before the message becomes available in the queue.
None
No
PolicyExpirationSeconds
int
The expiration time in seconds for the message.
None
No
PolicyMaxReceiveCount
int
The number of receive attempts allowed for the message before it is moved to the dead letter queue.
None
No
PolicyMaxReceiveQueue
String
The dead letter queue where the message will be moved after reaching the maximum receive attempts.
None
No
Id
String
The unique identifier of the message.
SentAt
LocalDateTime
The timestamp when the message was sent.
ExpiredAt
LocalDateTime
The timestamp when the message will expire.
DelayedTo
LocalDateTime
The timestamp when the message will be delivered.
IsError
boolean
Indicates if there was an error while sending the message.
Error
String
The error message if isError
is true.
Channel
String
The channel to poll messages from.
None
Yes
MaxItems
int
The maximum number of messages to poll.
1
No
WaitTimeout
int
The wait timeout in seconds for polling messages.
60
No
AutoAck
boolean
Indicates if messages should be auto-acknowledged.
false
No
VisibilitySeconds
int
Add a visibility timeout feature for messages.
0
No
Messages
List
The list of received queue messages.
Id
String
The unique identifier for the message.
Channel
String
The channel from which the message was received.
Metadata
String
Metadata associated with the message.
Body
byte[]
The body of the message in byte array format.
ClientID
String
The ID of the client that sent the message.
Tags
Map<String, String>
Key-value pairs representing tags for the message.
Timestamp
Instant
The timestamp when the message was created.
Sequence
long
The sequence number of the message.
ReceiveCount
int
The number of times the message has been received.
ReRouted
boolean
Indicates whether the message was rerouted.
ReRoutedFromQueue
String
The name of the queue from which the message was rerouted.
ExpirationAt
Instant
The expiration time of the message, if applicable.
DelayedTo
Instant
The time the message is delayed until, if applicable.