cog/stupidmq

此包已被弃用且不再维护。未建议替代包。

笨拙的消息队列

1.0.1 2014-08-07 07:10 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:22:31 UTC


README

基于 Symfony 组件的消息队列

使用方法

请注意:FileAdapter 尚未工作,请使用 AdapterPdoMysql 代替。

提供消息

$adpater = new \Cog\StupiMQ\AdapterFile( sys_get_temp_dir() );
$channel = new \Cog\StupiMQ\Channel( $adapter );
$queue = new \Cog\StupiMQ\Queue( $channel, 'myQueue' );

$queue->publish( 'hello world' );

消费消息

$adpater = new \Cog\StupiMQ\AdapterFile( sys_get_temp_dir() );
$channel = new \Cog\StupiMQ\Channel( $adapter );
$queue = new \Cog\StupiMQ\Queue( $channel, 'myQueue' );

$message = $queue->consume();

提供反馈

$adpater = new \Cog\StupiMQ\AdapterFile( sys_get_temp_dir() );
$channel = new \Cog\StupiMQ\Channel( $adapter );
$queue = new \Cog\StupiMQ\Queue( $channel, 'myQueue' );

$message = $queue->consume();
$queue->feedback(
    $message-getId(),
    CoG\StupidMQ\Message\MessageInterface::STATE_DONE),
    'my feedback'
);

待办事项

  • 终止 FileAdapter