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

Dynamic transport creation #31373

Open
DruGity opened this issue May 3, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@DruGity
Copy link

commented May 3, 2019

What i need is to create several queues right in code with different names, not in messenger.yaml. I have tried to do it with TransportFactory, but it is not what i need.
So the question is - Can i create queues dynamically? Does such opportunity exists in Messenger component?

@chalasr

This comment has been minimized.

Copy link
Member

commented May 5, 2019

I have tried to do it with TransportFactory, but it is not what i need.

Then can you explain what you mean by "creating queues dynamically"?
If what you want is to create the queue on the transport (doctrine:database:create like) then the SetupableTransportInterface coming in Symfony 4.3 might be the solution.

$transport = $transportFactory->createTransport('dsn');
$transport->setup();

It is implemented by all built-in transports.

@DruGity

This comment has been minimized.

Copy link
Author

commented May 6, 2019

What i need is to create several queues with different names, something like this:

foreach($array as $item) {
    $channel = $bunny->channel();
    $channel->queueDeclare($item['name']); 
}

Like in https://packagist.org/packages/bunny/bunny library
Can i do so in The Messenger Component? Because what i see now - that i can only create one transport with one queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.