Skip to content

Commit

Permalink
use same ackChannel for r/w and fix startup in development
Browse files Browse the repository at this point in the history
  • Loading branch information
paupm committed Aug 28, 2024
1 parent fed59b2 commit 2861c5d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
8 changes: 8 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ services:
MIDDLEWARES_SOCKET: "passthrough:///unix:///tmp/hp"
READ_ADAPTER: "AMQP"
WRITE_ADAPTER: "ELASTIC"
depends_on:
rabbit-mq:
condition: service_healthy
hp-middleware-pass:
volumes:
- ./sockets:/tmp
Expand All @@ -40,6 +43,11 @@ services:
ports:
- 15672:15672
- 5672:5672
healthcheck:
test: [ "CMD", "rabbitmqctl", "status"]
interval: 5s
timeout: 20s
retries: 5
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.4.2
ports:
Expand Down
8 changes: 4 additions & 4 deletions pkg/main.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package main

import (
"os"
"strconv"

"github.com/softonic/homing-pigeon/pkg/messages"
"github.com/softonic/homing-pigeon/pkg/middleware"
"github.com/softonic/homing-pigeon/pkg/readers"
"github.com/softonic/homing-pigeon/pkg/writers"
"k8s.io/klog"
"os"
"strconv"
)

func main() {
Expand All @@ -19,9 +20,8 @@ func main() {

bufLen = GetBufferLength("ACK_BUFFER_LENGTH")
ackCh1 := make(chan messages.Ack, bufLen)
ackCh2 := make(chan messages.Ack, bufLen)

reader, err := readers.NewReader(msgCh1, ackCh2)
reader, err := readers.NewReader(msgCh1, ackCh1)
if err != nil {
panic(err)
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/readers/adapters/amqp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import (
"bytes"
"crypto/tls"
"crypto/x509"
"html/template"
"os"
"strconv"
"strings"

"github.com/softonic/homing-pigeon/pkg/helpers"
"github.com/softonic/homing-pigeon/pkg/messages"
amqpAdapter "github.com/softonic/homing-pigeon/pkg/readers/adapters/amqp"
"github.com/streadway/amqp"
"html/template"
"k8s.io/klog"
"os"
"strconv"
"strings"
)

type Amqp struct {
Expand Down

0 comments on commit 2861c5d

Please sign in to comment.