Commit 3fc9f8e8 authored by Alexandre Moevi's avatar Alexandre Moevi

POC to check AMQP performances with che and axe

parent 9ea51652
Pipeline #6614 passed with stage
in 2 minutes and 10 seconds
......@@ -20,6 +20,7 @@ type EngineAxe struct {
canopsis.DefaultEngine
Options Options
References References
Messages int
}
func (e *EngineAxe) ConsumerChan() (<-chan amqp.Delivery, error) {
......@@ -185,11 +186,15 @@ func (e *EngineAxe) PeriodicalProcess() {
}
func (e *EngineAxe) ackMsg(msg amqp.Delivery) error {
err := e.References.ChannelSub.Ack(msg.DeliveryTag, false)
if err != nil {
e.DebugPrint("ack error: %+v", err)
e.Messages++
if e.Messages%10 == 0 {
err := e.References.ChannelSub.Ack(msg.DeliveryTag, true)
if err != nil {
e.DebugPrint("ack error: %+v", err)
}
return err
}
return err
return nil
}
func (e *EngineAxe) processWorkerError(err error, msg amqp.Delivery) error {
......
......@@ -19,6 +19,7 @@ type EngineChe struct {
canopsis.DefaultEngine
Options Options
References References
Messages int
}
func (e *EngineChe) ConsumerChan() (<-chan amqp.Delivery, error) {
......@@ -87,11 +88,15 @@ func (e *EngineChe) PeriodicalProcess() {
}
func (e *EngineChe) ackMsg(msg amqp.Delivery) error {
err := e.References.ChannelSub.Ack(msg.DeliveryTag, false)
if err != nil {
e.DebugPrint("ack error: %+v", err)
e.Messages++
if e.Messages%10 == 0 {
err := e.References.ChannelSub.Ack(msg.DeliveryTag, true)
if err != nil {
e.DebugPrint("ack error: %+v", err)
}
return err
}
return err
return nil
}
// processWorkerError read errors, ack amqp messages and stop the engine if needed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment