Documentation ¶
Index ¶
- Constants
- func AvailableMessageQueueType() []string
- func MessageQueueTypeValid(ty string) bool
- func SchemaValid(schema string) error
- type Closer
- type ConfigRabbitMQArgument
- type ExchangeQueueConfig
- type PublisherConfig
- type QosConfig
- type QueueBindConfig
- type QueueConfig
- type QueueConsumer
- type RabbitMQ
Constants ¶
const ( // ClientConsumerType tipe client rabbitnya sebagai consumer ClientConsumerType = "CONSUMER" // ClientProducerType tipe client rabbitnya sebagai producer ClientProducerType = "PRODUCER" )
Variables ¶
This section is empty.
Functions ¶
func AvailableMessageQueueType ¶
func AvailableMessageQueueType() []string
AvailableMessageQueueType is availabel type
func MessageQueueTypeValid ¶
MessageQueueTypeValid validate type
Types ¶
type Closer ¶
type Closer interface { RegisterSignalHandler() Shutdown() error }
Closer interface is for handling reconnection logic in a sane way Every reconnection supported struct should implement those methods in order to work properly
type ConfigRabbitMQArgument ¶
type ConfigRabbitMQArgument struct { Name string Schema string Host string Port int Username string Password string Vhost string AutoReconnect bool Type string PublisherConfig PublisherConfig QueueConfig QueueConfig QueueBind QueueBindConfig QueueConsumer QueueConsumer ExchangeQueue ExchangeQueueConfig QosConfig QosConfig }
ConfigRabbitMQArgument wrap config rabbitmq
type ExchangeQueueConfig ¶
ExchangeQueueConfig is wrap data for exhange queue config
type PublisherConfig ¶
type QueueBindConfig ¶
QueueBindConfig is wrap data for queue bind config
type QueueConfig ¶
QueueConfig is wrap data for queue config
type QueueConsumer ¶
type QueueConsumer struct {
AutoACK bool
}
QueueConsumer is wrap data for queue consumer
type RabbitMQ ¶
type RabbitMQ struct { // publisher only PublisherConfig PublisherConfig // general QueueConfig QueueConfig QueueBind QueueBindConfig QueueConsumer QueueConsumer ExchangeQueue ExchangeQueueConfig QosConfig QosConfig FnCallback func([]byte) // contains filtered or unexported fields }
RabbitMQ is wrap rabbitMQ
func NewQueue ¶
func NewQueue(cfg ConfigRabbitMQArgument) (*RabbitMQ, error)
NewQueue is Connection to rabbit
func (*RabbitMQ) Push ¶
Push will push data onto the queue, and wait for a confirm. If no confirms are received until within the resendTimeout, it continuously re-sends messages until a confirm is received. This will block until the server sends a confirm. Errors are only returned if the push action itself fails, see UnsafePush.
func (*RabbitMQ) RegisterSignalHandler ¶
func (session *RabbitMQ) RegisterSignalHandler()
RegisterSignalHandler watchs for interrupt signals and gracefully closes connection
func (*RabbitMQ) Stream ¶
Stream will continuously put queue items on the channel. It is required to call delivery.Ack when it has been successfully processed, or delivery.Nack when it fails. Ignoring this will cause data to build up on the server.
func (*RabbitMQ) UnsafePush ¶
UnsafePush will push to the queue without checking for confirmation. It returns an error if it fails to connect. No guarantees are provided for whether the server will receive the message.