Skip to content

Conversation

@Gsantomaggio
Copy link
Member

@Gsantomaggio Gsantomaggio commented Jan 31, 2025

Closes: #4
Closes: #5

RecoveryConfiguration

RecoveryConfiguration struct is now part of rabbitmq_amqp.AmqpConnOptions:

amqpConnection, err := rabbitmq_amqp.Dial(context.Background(), []string{"amqp://"}, &rabbitmq_amqp.AmqpConnOptions{
                  SASLType:    amqp.SASLTypeAnonymous(),
                  RecoveryConfiguration: &rabbitmq_amqp.RecoveryConfiguration{
			ActiveRecovery:           true,
			BackOffReconnectInterval: 5 * time.Second, 			
                         MaxReconnectAttempts: 5,
		},
	})

Enabled by default if not specified.
You can turn it off by setting ActiveRecovery=false

Producers and consumers will be restored automatically if the network is reconnected. See the reliable example to deal with network disconnection.

Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
@Gsantomaggio Gsantomaggio changed the title auto reconnect wip Auto recovery connection publishers and consumers Feb 7, 2025
@Gsantomaggio Gsantomaggio marked this pull request as ready for review February 7, 2025 09:55
@Gsantomaggio Gsantomaggio added this to the 0.1.0-alpha.2 milestone Feb 7, 2025
@Gsantomaggio Gsantomaggio merged commit 707fe72 into main Feb 7, 2025
1 check passed
@Gsantomaggio Gsantomaggio deleted the auto_reconnect_1 branch February 7, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement reconnection Deal with disconnection

2 participants