Skip to content

th2-net/th2-common-mq-batcher-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

th2-common-mq-batcher-go

Provides structures for batching th2-common's entities. Each batch is sent when its size is equal or exceed the size configured by BatchSizeBytes option or flush timeout is over configured by FlushMillis option

Transport message batcher

MqBatcher[MessageArguments] created by the batcher.NewMessageBatcher method allows to batch and send messages via MQ in th2 transport protocol

Configuration

The Batcher configuration include the options

  • Book (required) - th2 book name.
  • Group (required) - th2 session group name.
  • Protocol (optional) - default value for protocol. If it isn't specified and you don't specify batcher.MessageArguments.Protocol passed into the MqBatcher[MessageArguments].Send method, messages will be send with empty protocol.
  • BatchSizeBytes (1048576 by default) - max batch size.
  • FlushMillis (1000 by default) - max time interval in milliseconds between sending.
import (
	"github.com/th2-net/th2-common-mq-batcher-go/pkg/batcher"
)

config := batcher.MqMessageBatcherConfig{
	MqBatcherConfig: batcher.MqBatcherConfig{
		BatchSizeBytes: 1048576,
		FlushMillis:    1000,
		Book:           "book",
	},
	Protocol: "protocol",
	Group:    "group",
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published