Comments (13)
work around ( hack ) was to add an additional parameter for the message properties and use the AMQP expiration setting. So in the producer I added this
Original:
public function publish($msgBody, $routingKey = '')
{
$this->setupProducer();
$msg = new AMQPMessage($msgBody, array('content_type' => 'text/plain', 'delivery_mode' => 2));
$this->ch->basic_publish($msg, $this->exchangeOptions['name'], $routingKey);
}
Hack:
public function publish($msgBody, $routingKey = '', $msgProperties = array())
{
$this->setupProducer();
$msg = new AMQPMessage($msgBody, array_merge(array('content_type' => 'text/plain', 'delivery_mode' => 2), $msgProperties));
$this->ch->basic_publish($msg, $this->exchangeOptions['name'], $routingKey);
}
Then call like this:
$this->exchangeProducer->publish(json_encode($message),'', array('expiration' => '3600000'));
from rabbitmqbundle.
Right syntax, which works for me:
queue_options: {name: 'upload-picture', arguments: {'x-message-ttl': ['I', 3600000]}}
from rabbitmqbundle.
@slot can you point me to the documentation on this? I thought I had tried that syntax but maybe I had an error
from rabbitmqbundle.
Well as I said, it works for me. It's not properly documented but the example points you in the right direction:
queue_options: {name: 'upload-picture', arguments: {'x-ha-policy': ['S', 'all']}}
where 'S' is the datatype of the argument value.
Argument data is being type-checked and processed in \PhpAmqpLib\Wire\AMQPWriter in the write_table() method.
from rabbitmqbundle.
Would any of you mind documenting this in the README?
from rabbitmqbundle.
I will do it.
from rabbitmqbundle.
Done, in https://github.com/videlalvaro/RabbitMqBundle/pull/109
from rabbitmqbundle.
@slot The suggested syntax works on the queue level, I'm looking to add the x-message-ttl on the message level. So not all messages in the queue will have a expiration. The added documentation was needed but the suggested syntax does not work on a message level expiration but does for the queue.
Looking to implement the message options AMQP provides but with RabbitMQ
https://github.com/videlalvaro/php-amqplib/blob/master/PhpAmqpLib/Message/AMQPMessage.php
from rabbitmqbundle.
+1 for allowing to set a pet-ttl message, if it is supported by the protocol. The proposed hack is basically a 2-liner...
from rabbitmqbundle.
I'm seeing this issue. Is there a fix for this, 7 years later?
The problem is that the value is set, however, It's being stored as a string.
I'm using Rabbitmq 3.7.5, Erlang 20.1.7
from rabbitmqbundle.
Nevermind, it seems to work even though the rabbitmq web console displays the value as a string.
from rabbitmqbundle.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from rabbitmqbundle.
Already possible using $additionalProperties
.
from rabbitmqbundle.
Related Issues (20)
- Drop unsupported PHP versions HOT 1
- Drop unsupported Symfony versions HOT 1
- Cosumer Argument x-single-active-consumer HOT 6
- Invalid frame type 21 HOT 1
- Feature suggestion: add producer with batch producing capabilities HOT 4
- Update documentation for Symfony 6 HOT 5
- BaseAmqp closing connection in destructor HOT 2
- 1 Request 2 Record HOT 2
- Consumer disconnect event HOT 4
- ConsumerInterface service is not valid value for RPC server callback HOT 2
- How can i overwrite events? HOT 2
- Support to PHP 8.1 and Symfony 6.2 HOT 2
- Invalid signature of OldSound\RabbitMqBundle\RabbitMq\ProducerInterface HOT 2
- Symfony deprecations HOT 4
- Is it possible to use "PhpAmqpLib\Connection\AMQPConnectionFactory" instead of "AMQOldSound\RabbitMqBundle\RabbitMq\AMQPConnectionFactory"
- Symfony 5.2 pcntl_async_signals default changed HOT 2
- Add `--memory-limit` to `rabbitmq:rpc-server` HOT 7
- Has the package lost support? HOT 3
- Add "no_ack" consumer option (feature request) HOT 3
- Symfony 7.0 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rabbitmqbundle.