Skip to content

consumer already exists #21

@Mixnosha

Description

@Mixnosha

This method is called when creating a new consumer

Why don't we check the name of the new consumer with the old one? With this approach, you can't create multiple consumers for one queue

func (a *amqpConnection) registerConsumer(consumer MessageConsumer) error {
	for _, channel := range a.channels {
                // maybe check channel.consumer.Name != consumer.Name
		if channel.consumer != nil && channel.consumer.Queue == consumer.Queue {
			err := errConsumerAlreadyExists

			a.logger.Error(err, "Could not register consumer", logField{Key: "consumer", Value: consumer.Name})

			return err
		}
	}
 ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions