Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GROUP-103 Auto-delete Consumer Queues After Shutdown #24

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

makmn1
Copy link
Member

@makmn1 makmn1 commented Mar 28, 2024

Description of Changes

In a recent update, Group Sync instances were assigned a unique consumer queue to the group event exchange on RabbitMQ. This was configured through Spring Cloud Stream. The issue with this is those queues aren't deleted after the application is shutdown. Since those queues are unique to the instance that create them, they then accumulate messages until the memory limit has been exceeded.

The following configuration change has been added:

spring:
  cloud:
    stream:
      rabbit:
        bindings:
          processedEvents-in-0:
            consumer:
              anonymous-group-prefix: ${spring.application.name}

This change adds configuration specific to using the RabbitMQ binder to create an anonymous queue, which according to the Spring RabbitMQ docs:

anonymousGroupPrefix
When the binding has no group property, an anonymous, auto-delete queue is bound to the destination exchange. The default naming stragegy for such queues results in a queue named anonymous.<base64 representation of a UUID>. Set this property to change the prefix to something other than the default.
Default: anonymous..

This also meant having to remove the group property for the consumer queue in the Spring Cloud Stream configuration:

spring:
  cloud:
    stream:
      bindings:
          destination: group-event-results
          group: ${spring.application.name}-${random.value} # This line removed

Once this change goes into place, the pods will be restarted. Their old queues will be deleted manually via the RabbitMQ Admin dashboard in production, which isn't too bad since there are only two.

@makmn1 makmn1 added the bug Something isn't working label Mar 28, 2024
@makmn1 makmn1 self-assigned this Mar 28, 2024
@makmn1 makmn1 changed the title GROUP-103 Auto deletes group sync consumer queues GROUP-103 Auto-delete Consumer Queues After Shutdown Mar 28, 2024
@makmn1 makmn1 merged commit 22ec68a into main Mar 28, 2024
3 checks passed
@makmn1 makmn1 deleted the GROUP-103-Auto-Delete-Consumer-Queue branch March 28, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant