Skip to content

Commit e08a827

Browse files
committed
change vendor
1 parent 11b444c commit e08a827

File tree

8 files changed

+146
-143
lines changed

8 files changed

+146
-143
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
RabbitMQ Queue driver for Laravel
22
======================
3-
[![Latest Stable Version](https://poser.pugx.org/fintech-fab/laravel-queue-rabbitmq/v/stable)](https://packagist.org/packages/fintech-fab/laravel-queue-rabbitmq) [![Total Downloads](https://poser.pugx.org/fintech-fab/laravel-queue-rabbitmq/downloads)](https://packagist.org/packages/fintech-fab/laravel-queue-rabbitmq) [![Latest Unstable Version](https://poser.pugx.org/fintech-fab/laravel-queue-rabbitmq/v/unstable)](https://packagist.org/packages/fintech-fab/laravel-queue-rabbitmq) [![License](https://poser.pugx.org/fintech-fab/laravel-queue-rabbitmq/license)](https://packagist.org/packages/fintech-fab/laravel-queue-rabbitmq)
3+
[![Latest Stable Version](https://poser.pugx.org/vladimir-yuldashev/laravel-queue-rabbitmq/v/stable)](https://packagist.org/packages/vladimir-yuldashev/laravel-queue-rabbitmq) [![Total Downloads](https://poser.pugx.org/vladimir-yuldashev/laravel-queue-rabbitmq/downloads)](https://packagist.org/packages/vladimir-yuldashev/laravel-queue-rabbitmq) [![Latest Unstable Version](https://poser.pugx.org/vladimir-yuldashev/laravel-queue-rabbitmq/v/unstable)](https://packagist.org/packages/vladimir-yuldashev/laravel-queue-rabbitmq) [![License](https://poser.pugx.org/vladimir-yuldashev/laravel-queue-rabbitmq/license)](https://packagist.org/packages/vladimir-yuldashev/laravel-queue-rabbitmq)
44

55
####Installation
66

77
Require this package in your composer.json and run composer update (IMPORTANT! DO NOT USE "dev-master"):
88

9-
"fintech-fab/laravel-queue-rabbitmq": "5.1"
9+
"vladimir-yuldashev/laravel-queue-rabbitmq": "5.1"
1010

1111
After composer update is finished you need to add ServiceProvider to your `providers` array in `app.php`:
1212

13-
FintechFab\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider::class,
13+
VladimirYuldashev\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider::class,
1414

1515
Add these lines to your `app/config/queue.php` file to `connections` array:
1616

composer.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
{
2-
"name": "fintech-fab/laravel-queue-rabbitmq",
2+
"name": "vladimir-yuldashev/laravel-queue-rabbitmq",
33
"version": "5.1",
44
"description": "RabbitMQ driver for Laravel Queue",
5-
"license": "Apache-2.0",
5+
"license": "MIT",
66
"authors": [
7-
{
8-
"name": "FINTECH_FAB",
9-
"email": "dev@fintech-fab.ru"
10-
},
117
{
128
"name": "Vladimir Yuldashev",
139
"email": "misterio92@gmail.com"
@@ -21,7 +17,7 @@
2117
},
2218
"autoload": {
2319
"psr-0": {
24-
"FintechFab\\LaravelQueueRabbitMQ": "src/"
20+
"VladimirYuldashev\\LaravelQueueRabbitMQ": "src/"
2521
}
2622
},
2723
"minimum-stability": "dev"

src/FintechFab/LaravelQueueRabbitMQ/Queue/Jobs/RabbitMQJob.php

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

src/FintechFab/LaravelQueueRabbitMQ/LaravelQueueRabbitMQServiceProvider.php renamed to src/VladimirYuldashev/LaravelQueueRabbitMQ/LaravelQueueRabbitMQServiceProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
<?php namespace FintechFab\LaravelQueueRabbitMQ;
1+
<?php
2+
3+
namespace VladimirYuldashev\LaravelQueueRabbitMQ;
24

3-
use FintechFab\LaravelQueueRabbitMQ\Queue\Connectors\RabbitMQConnector;
45
use Illuminate\Support\ServiceProvider;
6+
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Connectors\RabbitMQConnector;
57

68
class LaravelQueueRabbitMQServiceProvider extends ServiceProvider
79
{

src/FintechFab/LaravelQueueRabbitMQ/Queue/Connectors/RabbitMQConnector.php renamed to src/VladimirYuldashev/LaravelQueueRabbitMQ/Queue/Connectors/RabbitMQConnector.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
<?php namespace FintechFab\LaravelQueueRabbitMQ\Queue\Connectors;
1+
<?php
2+
3+
namespace VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Connectors;
24

3-
use FintechFab\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
45
use Illuminate\Queue\Connectors\ConnectorInterface;
56
use PhpAmqpLib\Connection\AMQPConnection;
7+
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
68

79
class RabbitMQConnector implements ConnectorInterface
810
{
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<?php
2+
3+
namespace VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Jobs;
4+
5+
use Illuminate\Container\Container;
6+
use Illuminate\Contracts\Queue\Job as JobContract;
7+
use Illuminate\Queue\Jobs\Job;
8+
use PhpAmqpLib\Channel\AMQPChannel;
9+
use PhpAmqpLib\Message\AMQPMessage;
10+
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
11+
12+
class RabbitMQJob extends Job implements JobContract
13+
{
14+
15+
protected $connection;
16+
protected $channel;
17+
protected $queue;
18+
protected $message;
19+
20+
public function __construct(
21+
Container $container,
22+
RabbitMQQueue $connection,
23+
AMQPChannel $channel,
24+
$queue,
25+
AMQPMessage $message
26+
) {
27+
$this->container = $container;
28+
$this->connection = $connection;
29+
$this->channel = $channel;
30+
$this->queue = $queue;
31+
$this->message = $message;
32+
}
33+
34+
/**
35+
* Fire the job.
36+
*
37+
* @return void
38+
*/
39+
public function fire()
40+
{
41+
$this->resolveAndFire(json_decode($this->message->body, true));
42+
}
43+
44+
/**
45+
* Get the raw body string for the job.
46+
*
47+
* @return string
48+
*/
49+
public function getRawBody()
50+
{
51+
return $this->message->body;
52+
}
53+
54+
/**
55+
* Delete the job from the queue.
56+
*
57+
* @return void
58+
*/
59+
public function delete()
60+
{
61+
parent::delete();
62+
63+
$this->channel->basic_ack($this->message->delivery_info['delivery_tag']);
64+
}
65+
66+
/**
67+
* Get queue name
68+
*
69+
* @return string
70+
*/
71+
public function getQueue()
72+
{
73+
return $this->queue;
74+
}
75+
76+
/**
77+
* Release the job back into the queue.
78+
*
79+
* @param int $delay
80+
*
81+
* @return void
82+
*/
83+
public function release($delay = 0)
84+
{
85+
$this->delete();
86+
87+
$body = $this->message->body;
88+
$body = json_decode($body, true);
89+
90+
$attempts = $this->attempts();
91+
92+
// write attempts to body
93+
$body['data']['attempts'] = $attempts + 1;
94+
95+
$job = $body['job'];
96+
$data = $body['data'];
97+
98+
if ($delay > 0) {
99+
$this->connection->later($delay, $job, $data, $this->getQueue());
100+
} else {
101+
$this->connection->push($job, $data, $this->getQueue());
102+
}
103+
}
104+
105+
/**
106+
* Get the number of times the job has been attempted.
107+
*
108+
* @return int
109+
*/
110+
public function attempts()
111+
{
112+
$body = json_decode($this->message->body, true);
113+
114+
return isset($body['data']['attempts']) ? (int)$body['data']['attempts'] : 0;
115+
}
116+
117+
/**
118+
* Get the job identifier.
119+
*
120+
* @return string
121+
*/
122+
public function getJobId()
123+
{
124+
return $this->message->get('correlation_id');
125+
}
126+
127+
}

src/FintechFab/LaravelQueueRabbitMQ/Queue/RabbitMQQueue.php renamed to src/VladimirYuldashev/LaravelQueueRabbitMQ/Queue/RabbitMQQueue.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
<?php namespace FintechFab\LaravelQueueRabbitMQ\Queue;
1+
<?php
2+
3+
namespace VladimirYuldashev\LaravelQueueRabbitMQ\Queue;
24

35
use DateTime;
4-
use FintechFab\LaravelQueueRabbitMQ\Queue\Jobs\RabbitMQJob;
56
use Illuminate\Contracts\Queue\Queue as QueueContract;
67
use Illuminate\Queue\Queue;
78
use PhpAmqpLib\Channel\AMQPChannel;
89
use PhpAmqpLib\Connection\AMQPConnection;
910
use PhpAmqpLib\Message\AMQPMessage;
1011
use PhpAmqpLib\Wire\AMQPTable;
12+
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Jobs\RabbitMQJob;
1113

1214
class RabbitMQQueue extends Queue implements QueueContract
1315
{

src/examples/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44

55
'providers' => append_config([
6-
'FintechFab\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider',
6+
VladimirYuldashev\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider::class,
77
]),
88

99
];

0 commit comments

Comments
 (0)