@@ -28,11 +28,11 @@ type DefaultBus struct {
28
28
Outbox TxOutbox
29
29
PrefetchCount uint
30
30
AmqpConnStr string
31
- amqpConn * amqp.Connection
32
- outAmqpConn * amqp.Connection
31
+ ingressConn * amqp.Connection
32
+ egressConn * amqp.Connection
33
33
workers []* worker
34
- AMQPChannel * amqp.Channel
35
- outAMQPChannel * amqp.Channel
34
+ ingressChannel * amqp.Channel
35
+ egressChannel * amqp.Channel
36
36
serviceQueue amqp.Queue
37
37
rpcQueue amqp.Queue
38
38
SvcName string
@@ -84,7 +84,7 @@ func (b *DefaultBus) createRPCQueue() (amqp.Queue, error) {
84
84
*/
85
85
uid := xid .New ().String ()
86
86
qName := b .SvcName + "_rpc_" + uid
87
- q , e := b .AMQPChannel .QueueDeclare (qName ,
87
+ q , e := b .ingressChannel .QueueDeclare (qName ,
88
88
false , /*durable*/
89
89
true , /*autoDelete*/
90
90
false , /*exclusive*/
@@ -98,7 +98,7 @@ func (b *DefaultBus) createServiceQueue() (amqp.Queue, error) {
98
98
var q amqp.Queue
99
99
100
100
if b .PurgeOnStartup {
101
- msgsPurged , purgeError := b .AMQPChannel .QueueDelete (qName , false /*ifUnused*/ , false /*ifEmpty*/ , false /*noWait*/ )
101
+ msgsPurged , purgeError := b .ingressChannel .QueueDelete (qName , false /*ifUnused*/ , false /*ifEmpty*/ , false /*noWait*/ )
102
102
if purgeError != nil {
103
103
b .Log ().WithError (purgeError ).WithField ("deleted_messages" , msgsPurged ).Error ("failed to purge queue" )
104
104
return q , purgeError
@@ -109,7 +109,7 @@ func (b *DefaultBus) createServiceQueue() (amqp.Queue, error) {
109
109
if b .DLX != "" {
110
110
args ["x-dead-letter-exchange" ] = b .DLX
111
111
}
112
- q , e := b .AMQPChannel .QueueDeclare (qName ,
112
+ q , e := b .ingressChannel .QueueDeclare (qName ,
113
113
true , /*durable*/
114
114
false , /*autoDelete*/
115
115
false , /*exclusive*/
@@ -125,7 +125,7 @@ func (b *DefaultBus) createServiceQueue() (amqp.Queue, error) {
125
125
func (b * DefaultBus ) bindServiceQueue () error {
126
126
127
127
if b .deadletterHandler != nil && b .DLX != "" {
128
- err := b .AMQPChannel .ExchangeDeclare (b .DLX , /*name*/
128
+ err := b .ingressChannel .ExchangeDeclare (b .DLX , /*name*/
129
129
"fanout" , /*kind*/
130
130
true , /*durable*/
131
131
false , /*autoDelete*/
@@ -145,7 +145,7 @@ func (b *DefaultBus) bindServiceQueue() error {
145
145
for _ , subscription := range b .DelayedSubscriptions {
146
146
topic := subscription [0 ]
147
147
exchange := subscription [1 ]
148
- e := b .AMQPChannel .ExchangeDeclare (exchange , /*name*/
148
+ e := b .ingressChannel .ExchangeDeclare (exchange , /*name*/
149
149
"topic" , /*kind*/
150
150
true , /*durable*/
151
151
false , /*autoDelete*/
@@ -179,32 +179,32 @@ func (b *DefaultBus) Start() error {
179
179
180
180
var e error
181
181
//create amqo connection and channel
182
- if b .amqpConn , e = b .connect (MaxRetryCount ); e != nil {
182
+ if b .ingressConn , e = b .connect (MaxRetryCount ); e != nil {
183
183
return e
184
184
}
185
- if b .outAmqpConn , e = b .connect (MaxRetryCount ); e != nil {
185
+ if b .egressConn , e = b .connect (MaxRetryCount ); e != nil {
186
186
return e
187
187
}
188
188
189
- if b .AMQPChannel , e = b .createAMQPChannel (b .amqpConn ); e != nil {
189
+ if b .ingressChannel , e = b .createAMQPChannel (b .ingressConn ); e != nil {
190
190
return e
191
191
}
192
- if b .outAMQPChannel , e = b .createAMQPChannel (b .outAmqpConn ); e != nil {
192
+ if b .egressChannel , e = b .createAMQPChannel (b .egressConn ); e != nil {
193
193
return e
194
194
}
195
195
196
196
//register on failure notifications
197
197
b .amqpErrors = make (chan * amqp.Error )
198
198
b .amqpBlocks = make (chan amqp.Blocking )
199
- b .amqpConn .NotifyClose (b .amqpErrors )
200
- b .amqpConn .NotifyBlocked (b .amqpBlocks )
201
- b .outAmqpConn .NotifyClose (b .amqpErrors )
202
- b .outAmqpConn .NotifyBlocked (b .amqpBlocks )
203
- b .outAMQPChannel .NotifyClose (b .amqpErrors )
199
+ b .ingressConn .NotifyClose (b .amqpErrors )
200
+ b .ingressConn .NotifyBlocked (b .amqpBlocks )
201
+ b .egressConn .NotifyClose (b .amqpErrors )
202
+ b .egressConn .NotifyBlocked (b .amqpBlocks )
203
+ b .egressChannel .NotifyClose (b .amqpErrors )
204
204
//TODO:Figure out what should be done
205
205
206
206
//init the outbox that sends the messages to the amqp transport and handles publisher confirms
207
- if e := b .Outgoing .init (b .outAMQPChannel , b .Confirm , true ); e != nil {
207
+ if e := b .Outgoing .init (b .egressChannel , b .Confirm , true ); e != nil {
208
208
return e
209
209
}
210
210
/*
@@ -214,7 +214,7 @@ func (b *DefaultBus) Start() error {
214
214
if b .IsTxnl {
215
215
216
216
var amqpChan * amqp.Channel
217
- if amqpChan , e = b .createAMQPChannel (b .outAmqpConn ); e != nil {
217
+ if amqpChan , e = b .createAMQPChannel (b .egressConn ); e != nil {
218
218
b .Log ().WithError (e ).Error ("failed to create amqp channel for transactional outbox" )
219
219
return e
220
220
}
@@ -275,7 +275,7 @@ func (b *DefaultBus) createBusWorkers(workerNum uint) ([]*worker, error) {
275
275
workers := make ([]* worker , 0 )
276
276
for i := uint (0 ); i < workerNum ; i ++ {
277
277
//create a channel per worker as we can't share channels across go routines
278
- amqpChan , createChanErr := b .createAMQPChannel (b .amqpConn )
278
+ amqpChan , createChanErr := b .createAMQPChannel (b .ingressConn )
279
279
if createChanErr != nil {
280
280
return nil , createChanErr
281
281
}
@@ -687,7 +687,7 @@ func (b *DefaultBus) registerHandlerImpl(exchange, routingKey string, msg Messag
687
687
}
688
688
689
689
func (b * DefaultBus ) bindQueue (topic , exchange string ) error {
690
- return b .AMQPChannel .QueueBind (b .serviceQueue .Name , topic , exchange , false /*noWait*/ , nil /*args*/ )
690
+ return b .ingressChannel .QueueBind (b .serviceQueue .Name , topic , exchange , false /*noWait*/ , nil /*args*/ )
691
691
}
692
692
693
693
type rpcPolicy struct {
0 commit comments