Queue: Add missing code to make it work outside of laravel #4401

Closed
wants to merge 1 commit into
from

Projects

None yet

6 participants

@Flynsarmy
Contributor

The current readme presents the following error when using an iron queue with Illuminate/queue outside of Laravel

Fatal error: Uncaught exception 'ReflectionException' with message 'Class encrypter does not exist' in /vendor/illuminate/container/Illuminate/Container/Container.php on line 485

The attached commit fixes this.

@JosephSilber
Contributor

Are you using the Iron queue?

I think that's the only one that uses the encrypter (though I'm not sure).

If so, that should be added to the readme.

@Flynsarmy
Contributor

I haven't tested it but wouldn't SQS and any other external queue services need Request aswell? Figured they'd also encrypt their tasks.

@JosephSilber
Contributor

I don't think the SQS driver uses encrypter. Read the code yourself.

@Flynsarmy
Contributor

Why was this closed without a merge? It's clearly required for iron queues outside of laravel. You just get an error if you don't add it in...

@mnori
mnori commented Sep 11, 2014

This issue also occurs when you want to use a Beanstalk queue. I got around it by using:

$this->queue->getContainer()->bind('encrypter', function() {
    return new \Illuminate\Encryption\Encrypter('clowdy');
});

Which is described here:
https://www.flynsarmy.com/2014/05/using-illuminatequeue-outside-laravel/

@Flynsarmy
Contributor

Yea, it was pretty ridiculous that Taylor closed this without merging. Probably saw Joseph's entirely unhelpful and irrelevant messages and assumed nothing needed to be done.

@taylorotwell
Member

Do I need to revisit?

On Sep 11, 2014, at 5:11 PM, Flynsarmy notifications@github.com wrote:

Yea, it was pretty ridiculous that Taylor closed this without merging. Probably saw Joseph's entirely unhelpful and irrelevant messages and assumed nothing needed to be done.


Reply to this email directly or view it on GitHub.

@Flynsarmy
Contributor

That would be great. If you attempt to use certain drivers with Illuminate/Queue outside of laravel you just get an error message with nothing in the readme on how to fix it.

The lines in my PR are required for Iron queues to work. I've only tested Iron.io but I guess they'd be required for any queue service not on localhost to work.

@crynobone
Contributor

The lines in my PR are required for Iron queues to work. I've only tested Iron.io but I'm fairly sure they'd be required for any queue service not on localhost to work.

https://github.com/laravel/framework/blob/4.2/src/Illuminate/Queue/QueueServiceProvider.php#L241 only Iron.io requires it.

But wait, https://github.com/laravel/framework/blob/4.2/src/Illuminate/Queue/QueueManager.php#L95 sneak in the "encryptor" on all queue connection.

@Flynsarmy
Contributor

In any case, if a line is required for it to work it should be in the readme. Hence the PR

@taylorotwell
Member

I think Request is just used by Iron for marshalling push queue request. So we can probably indicate that caveat in the readme.

@johnnye
johnnye commented Oct 17, 2014

@taylorotwell it would be good to include this in the documentation. I'm running into problems with the encrypter not being present (easily solved), but it seems to be an issue if you're just using Capsule queue and an encrypter doesn't exist already. I would however use a bindIf(). Do I need to do another PR with a bit more detail?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment