Skip to content

Documentation - quick tour #884

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

Closed
Kon-Xen opened this issue Jun 6, 2019 · 8 comments
Closed

Documentation - quick tour #884

Kon-Xen opened this issue Jun 6, 2019 · 8 comments
Labels

Comments

@Kon-Xen
Copy link

Kon-Xen commented Jun 6, 2019

Hi,
Noticed that in the quick tour of the documentation for the symfony bundle
The example instructions suggest for the config

enqueue:
    default:
        transport: "amqp:"
        client: ~

that gives a yaml syntax error....
Could it be that instead the example should read ?

enqueue:
    transport:
        default: "amqp:"
    client: ~

Best,

K.

@Steveb-p
Copy link
Contributor

Steveb-p commented Jun 6, 2019

@Kon-Xen No, the second example would be wrong for the current version. It was correct for 0.8.x. Since then clients and transports are tied under a single key.

EDIT:
You can see the code for it here:

$rootNode
->requiresAtLeastOneElement()
->useAttributeAsKey('key')
->arrayPrototype()
->children()
->append(TransportFactory::getConfiguration())
->append(TransportFactory::getQueueConsumerConfiguration())
->append(ClientFactory::getConfiguration($this->debug))
->append($this->getMonitoringConfiguration())
->append($this->getAsyncCommandsConfiguration())
->append($this->getJobConfiguration())
->append($this->getAsyncEventsConfiguration())
->arrayNode('extensions')->addDefaultsIfNotSet()->children()
->booleanNode('doctrine_ping_connection_extension')->defaultFalse()->end()
->booleanNode('doctrine_clear_identity_map_extension')->defaultFalse()->end()
->booleanNode('signal_extension')->defaultValue(function_exists('pcntl_signal_dispatch'))->end()
->booleanNode('reply_extension')->defaultTrue()->end()
->end()->end()
->end()
->end()
;

EDIT2:

that gives a yaml syntax error

It's probably unrelated to enqueue. Check if you aren't mixing tabs & spaces in your yaml file.

@Kon-Xen
Copy link
Author

Kon-Xen commented Jun 6, 2019

what would be the correct syntax then ? because what is on the example is not working.

@Steveb-p
Copy link
Contributor

Steveb-p commented Jun 6, 2019

what would be the correct syntax then ?

Check for some common yaml errors in your configuration, like mixing tabs & spaces (yaml requires you to use one or the other for indentation, but not both).

If it were a misconfiguration issue, you would have a different exception, for example:
Fatal error: Uncaught Symfony\Component\Config\Definition\Exception\InvalidConfigurationException: Unrecognized option "dsn" under "enqueue.transport"

Also check if you're not using obsolete 0.8.x version for enqueue bundle, since the configuration presented in quick tour is for current 0.9.x.

@Kon-Xen
Copy link
Author

Kon-Xen commented Jun 6, 2019

Thank you for your prompt responses and
All understood. (and I have checked spaces & tabs and what not & Managed to figure things out after many hours)
There is a confusion however.
a. Yes it turns out I am using 8.42 ver.
b. see The config example here: https://github.com/php-enqueue/enqueue-dev/blob/master/docs/bundle/quick_tour.md
and compare to here: https://php-enqueue.github.io/bundle/config_reference/

@Kon-Xen Kon-Xen closed this as completed Jun 6, 2019
@Steveb-p
Copy link
Contributor

Steveb-p commented Jun 6, 2019

@Kon-Xen both https://php-enqueue.github.io/bundle/quick_tour/ and https://php-enqueue.github.io/bundle/config_reference/ look fine to me (well, except that we're already working on expanding comments in config reference to better explain what options do what).

What do you mean?

@Kon-Xen
Copy link
Author

Kon-Xen commented Jun 6, 2019

If you say they are fine, they are fine.

Now, if you fancy a chat I can try to elaborate...
Assuming that I understood correctly,
https://github.com/php-enqueue/enqueue-dev/blob/master/docs/bundle/quick_tour.md
is confusing me because:
a) wording, "First, you have to configure a transport layer and set one to be default"
Do I have to set up more than one transports?
b) example shows "default:" where I would expect to see "key:"

enqueue:
    default:
        transport: "amqp:"
        client: ~

because as you explained "Since then clients and transports are tied under a single key."

enqueue:
    key:
        default:
            transport: "amqp:"
            client: ~

then again it may be not... I don't know... because in the other example
there is no "default:" and cannot compare the two to figure it out.

Hope it makes sense, my apologies if not.

@Steveb-p
Copy link
Contributor

Steveb-p commented Jun 6, 2019

Now, if you fancy a chat I can try to elaborate

I'm usually available on enqueue's gitter channel if you'd like to discuss enqueue's usage without polluting the issues in the repository with just the discussion :)

a) wording, "First, you have to configure a transport layer and set one to be default"

Agreed, this sentence might need changing. What it was supposed to say is you need to configure at least one transport. If there is only one it will be considered default. If there are many, then the one under default key will become default or - if there is none like that - the first one.

b) example shows "default:" where I would expect to see "key:"

Not at all.
Bundle expects it's configuration to be specified under enqueue. Then, each entry under that is considered a key - for example default. This is similar in design to how doctrine bundle allows configuration of multiple entity managers. Take this configuration as a sample for multiple transports:

enqueue:
    default: # <--- This will become default, because it's keyed as one. Also, it's first :P
        transport: "amqp:"
        client: ~
    some_key:
        transport: "null:"
        client: ~
    key:
        transport: "some-other-transport-dsn://"
        client: ~
    some_other_key_for_yet_another_transport:
        transport: "dsn://"
        client: ~

Here you have 4 combinations of transports: default, some_key, key and some_other_key_for_yet_another_transport.

Keys (or maybe I should call them "names") are entirely up to the developer.

Steveb-p added a commit to Steveb-p/enqueue-dev that referenced this issue Jun 6, 2019
@Steveb-p
Copy link
Contributor

Steveb-p commented Jun 6, 2019

@Kon-Xen I've created a PR that hopefully addresses your case. See if it clarifies configuration and usage for you.

makasim added a commit that referenced this issue Jun 7, 2019
[Bundle] Expand quick tour for Symfony Bundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants