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

[FsBroker] This message breaks the queue #387

Closed
cbonnissent opened this issue Mar 1, 2018 · 9 comments
Closed

[FsBroker] This message breaks the queue #387

cbonnissent opened this issue Mar 1, 2018 · 9 comments
Labels

Comments

@cbonnissent
Copy link

$message = $psrContext->createMessage('                             |{"body":"aMessageData","properties":{"enqueue.topic_name":"user_updated"},"headers":{"content_type":"text\/plain","message_id":"90979b6c-d9ff-4b39-9938-878b83a95360","timestamp":1519899428,"reply_to":null,"co
rrelation_id":""}}');

When I consume the message I have this error

PHP Fatal error: Uncaught LogicException: The frame could start from either " " or "|". The malformed frame starts with """. in XXXX/enqueue/vendor/enqueue/fs/FsConsumer.php:125 Stack trace: #0 [internal function]: Enqueue\Fs\FsConsumer->Enqueue\Fs\{closure}(Object(Enqueue\Fs\FsDestination), Resource id #29) #1 XXXX/enqueue/vendor/enqueue/fs/FsContext.php(121): call_user_func(Object(Closure), Object(Enqueue\Fs\FsDestination), Resource id #29) #2 XXXX/enqueue/vendor/enqueue/fs/FsConsumer.php(155): Enqueue\Fs\FsContext->workWithFile(Object(Enqueue\Fs\FsDestination), 'c+', Object(Closure)) #3 XXXX/enqueue/vendor/enqueue/fs/FsConsumer.php(91): Enqueue\Fs\FsConsumer->receiveNoWait() #4 XXXX/enqueue/consumer.php(16): Enqueue\Fs\FsConsumer->receive() #5 {main} thrown in XXXX/enqueue/vendor/enqueue/fs/FsConsumer.php on line 125

@makasim
Copy link
Member

makasim commented Mar 1, 2018

Any reason why you send such a message? why does it start with '(' |{'. Looks like an internal format of fs transport.

@cbonnissent
Copy link
Author

Hello, I test the FsBroker and I want to see if the message are isolated in the file or if I need to avoid some messages beginning.
I agree that in production there is a very low probability to see messages like this one.

@makasim
Copy link
Member

makasim commented Mar 1, 2018

I don't suggest you use fs transport in production, it is blocking, provides very basic features, does not scale and might slow down when the queue file grows.

@makasim
Copy link
Member

makasim commented Mar 1, 2018

I think fs transport should throw an exception if it finds a special char sequence. wdyt?

@cbonnissent cbonnissent changed the title [FsBroker] This message broke the queue [FsBroker] This message breaks the queue Mar 1, 2018
@cbonnissent
Copy link
Author

You should write this advice on the doc of the transport (that is build only for dev purpose, not for production), no ?
The usage of the Doctrine transport can be envisaged in production ? (I don't want to install another components like rabbitMQ)
Yes, you should throw an exception, or you could escape the special char sequence

@makasim
Copy link
Member

makasim commented Mar 1, 2018

I am going to add an exception, as for escaping it is not that easy to do.

DBAL is meant to be used in prod.

@cbonnissent
Copy link
Author

Thank you for your advice !

@makasim
Copy link
Member

makasim commented Mar 10, 2018

escaping has been implemented.

@makasim makasim closed this as completed Mar 10, 2018
@cbonnissent
Copy link
Author

Thank you !

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