Skip to content

Commit c653c42

Browse files
committed
remove horizon
1 parent 3ee0489 commit c653c42

File tree

8 files changed

+3
-212
lines changed

8 files changed

+3
-212
lines changed

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ Setup connection in `config/queue.php`
2525

2626
'driver' => 'rabbitmq',
2727

28-
/*
29-
* Set to "horizon" if you wish to use Laravel Horizon.
30-
*/
31-
'worker' => env('RABBITMQ_WORKER', 'default'),
32-
3328
'dsn' => env('RABBITMQ_DSN', null),
3429

3530
/*
@@ -129,10 +124,6 @@ Setup connection in `config/queue.php`
129124

130125
Once you completed the configuration you can use Laravel Queue API. If you used other queue drivers you do not need to change anything else. If you do not know how to use Queue API, please refer to the official Laravel documentation: http://laravel.com/docs/queues
131126

132-
## Laravel Horizon Usage
133-
134-
Starting with 7.4, this package supports [Laravel Horizon](http://horizon.laravel.com) out of the box. Firstly, install Horizon and then set `RABBITMQ_WORKER` to `horizon`.
135-
136127
## Lumen Usage
137128

138129
For Lumen usage the service provider should be registered manually as follow in `bootstrap/app.php`:

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vladimir-yuldashev/laravel-queue-rabbitmq",
3-
"description": "RabbitMQ driver for Laravel Queue. Supports Laravel Horizon",
3+
"description": "RabbitMQ driver for Laravel Queue",
44
"license": "MIT",
55
"authors": [
66
{
@@ -20,8 +20,7 @@
2020
"require-dev": {
2121
"phpunit/phpunit": "^7.0",
2222
"illuminate/events": "5.6.*|5.7.*|5.8.*",
23-
"mockery/mockery": "^1.0",
24-
"laravel/horizon": "^3.0"
23+
"mockery/mockery": "^1.0"
2524
},
2625
"autoload": {
2726
"psr-4": {

config/rabbitmq.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99

1010
'driver' => 'rabbitmq',
1111

12-
/*
13-
* Set to "horizon" if you wish to use Laravel Horizon.
14-
*/
15-
'worker' => env('RABBITMQ_WORKER', 'default'),
16-
1712
'dsn' => env('RABBITMQ_DSN', null),
1813

1914
/*

src/Horizon/Listeners/RabbitMQFailedEvent.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/Horizon/RabbitMQQueue.php

Lines changed: 0 additions & 115 deletions
This file was deleted.

src/Queue/Connectors/RabbitMQConnector.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
use Illuminate\Support\Arr;
66
use Interop\Amqp\AmqpContext;
7-
use InvalidArgumentException;
87
use Illuminate\Contracts\Queue\Queue;
9-
use Illuminate\Queue\Events\JobFailed;
108
use Interop\Amqp\AmqpConnectionFactory;
119
use Enqueue\AmqpTools\DelayStrategyAware;
1210
use Illuminate\Contracts\Events\Dispatcher;
@@ -16,8 +14,6 @@
1614
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
1715
use Interop\Amqp\AmqpConnectionFactory as InteropAmqpConnectionFactory;
1816
use Enqueue\AmqpLib\AmqpConnectionFactory as EnqueueAmqpConnectionFactory;
19-
use VladimirYuldashev\LaravelQueueRabbitMQ\Horizon\Listeners\RabbitMQFailedEvent;
20-
use VladimirYuldashev\LaravelQueueRabbitMQ\Horizon\RabbitMQQueue as HorizonRabbitMQQueue;
2117

2218
class RabbitMQConnector implements ConnectorInterface
2319
{
@@ -74,18 +70,6 @@ public function connect(array $config): Queue
7470
$context->close();
7571
});
7672

77-
$worker = Arr::get($config, 'worker', 'default');
78-
79-
if ($worker === 'default') {
80-
return new RabbitMQQueue($context, $config);
81-
}
82-
83-
if ($worker === 'horizon') {
84-
$this->dispatcher->listen(JobFailed::class, RabbitMQFailedEvent::class);
85-
86-
return new HorizonRabbitMQQueue($context, $config);
87-
}
88-
89-
throw new InvalidArgumentException('Invalid worker.');
73+
return new RabbitMQQueue($context, $config);
9074
}
9175
}

src/Queue/Jobs/RabbitMQJob.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Illuminate\Database\DetectsDeadlocks;
1313
use Illuminate\Contracts\Queue\Job as JobContract;
1414
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
15-
use VladimirYuldashev\LaravelQueueRabbitMQ\Horizon\RabbitMQQueue as HorizonRabbitMQQueue;
1615

1716
class RabbitMQJob extends Job implements JobContract
1817
{
@@ -100,11 +99,6 @@ public function delete(): void
10099
parent::delete();
101100

102101
$this->consumer->acknowledge($this->message);
103-
104-
// required for Laravel Horizon
105-
if ($this->connection instanceof HorizonRabbitMQQueue) {
106-
$this->connection->deleteReserved($this->queue, $this);
107-
}
108102
}
109103

110104
/** {@inheritdoc}

src/Queue/RabbitMQQueue.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use RuntimeException;
66
use Illuminate\Queue\Queue;
7-
use Illuminate\Support\Str;
87
use Interop\Amqp\AmqpQueue;
98
use Interop\Amqp\AmqpTopic;
109
use Psr\Log\LoggerInterface;
@@ -240,16 +239,6 @@ protected function getQueueName($queueName = null)
240239
return $queueName ?: $this->queueName;
241240
}
242241

243-
/**
244-
* Get a random ID string.
245-
*
246-
* @return string
247-
*/
248-
protected function getRandomId(): string
249-
{
250-
return Str::random(32);
251-
}
252-
253242
/**
254243
* @param string $action
255244
* @param \Throwable $e

0 commit comments

Comments
 (0)