| @@ 57-78 (lines=22) @@ | ||
| 54 | ); |
|
| 55 | } |
|
| 56 | ||
| 57 | public function consume(FrameChannel $channel, Consume $command): Frame |
|
| 58 | { |
|
| 59 | $consumerTag = ''; |
|
| 60 | ||
| 61 | if (!$command->shouldAutoGenerateConsumerTag()) { |
|
| 62 | $consumerTag = $command->consumerTag(); |
|
| 63 | } |
|
| 64 | ||
| 65 | return new Frame( |
|
| 66 | Type::method(), |
|
| 67 | $channel, |
|
| 68 | Methods::get('basic.consume'), |
|
| 69 | new UnsignedShortInteger(new Integer(0)), //ticket (reserved) |
|
| 70 | new ShortString(new Str($command->queue())), |
|
| 71 | new ShortString(new Str($consumerTag)), |
|
| 72 | new Bits(!$command->isLocal()), |
|
| 73 | new Bits($command->shouldAutoAcknowledge()), |
|
| 74 | new Bits($command->isExclusive()), |
|
| 75 | new Bits(!$command->shouldWait()), |
|
| 76 | new Table(new Map('string', Value::class)) //todo: use $command->arguments() |
|
| 77 | ); |
|
| 78 | } |
|
| 79 | ||
| 80 | public function get(FrameChannel $channel, Get $command): Frame |
|
| 81 | { |
|
| @@ 30-51 (lines=22) @@ | ||
| 27 | ||
| 28 | final class Queue implements QueueInterface |
|
| 29 | { |
|
| 30 | public function declare(FrameChannel $channel, Declaration $command): Frame |
|
| 31 | { |
|
| 32 | $name = ''; |
|
| 33 | ||
| 34 | if (!$command->shouldAutoGenerateName()) { |
|
| 35 | $name = $command->name(); |
|
| 36 | } |
|
| 37 | ||
| 38 | return new Frame( |
|
| 39 | Type::method(), |
|
| 40 | $channel, |
|
| 41 | Methods::get('queue.declare'), |
|
| 42 | new UnsignedShortInteger(new Integer(0)), //ticket (reserved) |
|
| 43 | new ShortString(new Str($name)), |
|
| 44 | new Bits($command->isPassive()), |
|
| 45 | new Bits($command->isDurable()), |
|
| 46 | new Bits($command->isExclusive()), |
|
| 47 | new Bits($command->isAutoDeleted()), |
|
| 48 | new Bits(!$command->shouldWait()), |
|
| 49 | new Table(new Map('string', Value::class)) //todo: use $command->arguments() |
|
| 50 | ); |
|
| 51 | } |
|
| 52 | ||
| 53 | public function delete(FrameChannel $channel, Deletion $command): Frame |
|
| 54 | { |
|