Skip to content

Commit e825a94

Browse files
authored
Release v17.09-rc13
Release v17.09-rc13 (#26)
1 parent b714e75 commit e825a94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+323
-39
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KHS1994_LNMP_DOCKER_VERSION=v17.09-rc12
1+
KHS1994_LNMP_DOCKER_VERSION=v17.09-rc13
22

33
# Docker Compose VAR
44

Changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Changelog
55

66
#### v17.12 rc1
77

8+
#### v17.09 rc13
9+
10+
Bug fixes:
11+
* Fix `Dockerfile`
12+
* Fix `RabbitMQ` error
13+
814
#### v17.09 rc12
915

1016
Bug fixes:

README.cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
* [Docker CE](https://github.com/docker/docker-ce) 17.09.0+
2020

21-
* [Docker Composer](https://github.com/docker/compose) 1.16.1+
21+
* [Docker Compose](https://github.com/docker/compose) 1.16.1+
2222

2323
# 快速上手
2424

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To use LNMP Docker,you need:
1717

1818
* [Docker CE](https://github.com/docker/docker-ce) 17.09.0+
1919

20-
* [Docker Composer](https://github.com/docker/compose) 1.16.1+
20+
* [Docker Compose](https://github.com/docker/compose) 1.16.1+
2121

2222
# Quick Start
2323

app/demo/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
.idea
1+
.ide
2+
vendor
3+
composer.lock

app/demo/amqp_consumer.php

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
// from https://github.com/php-amqplib/php-amqplib demo
4+
5+
include(__DIR__ . '/config.php');
6+
use PhpAmqpLib\Connection\AMQPStreamConnection;
7+
8+
$exchange = 'router';
9+
$queue = 'msgs';
10+
$consumerTag = 'consumer';
11+
12+
$connection = new AMQPStreamConnection(HOST, PORT, USER, PASS, VHOST);
13+
$channel = $connection->channel();
14+
15+
/*
16+
The following code is the same both in the consumer and the producer.
17+
In this way we are sure we always have a queue to consume from and an
18+
exchange where to publish messages.
19+
*/
20+
21+
/*
22+
name: $queue
23+
passive: false
24+
durable: true // the queue will survive server restarts
25+
exclusive: false // the queue can be accessed in other channels
26+
auto_delete: false //the queue won't be deleted once the channel is closed.
27+
*/
28+
$channel->queue_declare($queue, false, true, false, false);
29+
30+
/*
31+
name: $exchange
32+
type: direct
33+
passive: false
34+
durable: true // the exchange will survive server restarts
35+
auto_delete: false //the exchange won't be deleted once the channel is closed.
36+
*/
37+
38+
$channel->exchange_declare($exchange, 'direct', false, true, false);
39+
40+
$channel->queue_bind($queue, $exchange);
41+
42+
/**
43+
* @param \PhpAmqpLib\Message\AMQPMessage $message
44+
*/
45+
function process_message($message)
46+
{
47+
echo "\n--------\n";
48+
echo $message->body;
49+
echo "\n--------\n";
50+
51+
$message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']);
52+
53+
// Send a message with the string "quit" to cancel the consumer.
54+
if ($message->body === 'quit') {
55+
$message->delivery_info['channel']->basic_cancel($message->delivery_info['consumer_tag']);
56+
}
57+
}
58+
59+
/*
60+
queue: Queue from where to get the messages
61+
consumer_tag: Consumer identifier
62+
no_local: Don't receive messages published by this consumer.
63+
no_ack: Tells the server if the consumer will acknowledge the messages.
64+
exclusive: Request exclusive consumer access, meaning only this consumer can access the queue
65+
nowait:
66+
callback: A PHP Callback
67+
*/
68+
69+
$channel->basic_consume($queue, $consumerTag, false, false, false, false, 'process_message');
70+
71+
/**
72+
* @param \PhpAmqpLib\Channel\AMQPChannel $channel
73+
* @param \PhpAmqpLib\Connection\AbstractConnection $connection
74+
*/
75+
function shutdown($channel, $connection)
76+
{
77+
$channel->close();
78+
$connection->close();
79+
}
80+
81+
register_shutdown_function('shutdown', $channel, $connection);
82+
83+
// Loop as long as the channel has callbacks registered
84+
while (count($channel->callbacks)) {
85+
$channel->wait();
86+
}

app/demo/amqp_publisher.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
// from https://github.com/php-amqplib/php-amqplib demo
4+
5+
include(__DIR__ . '/config.php');
6+
7+
use PhpAmqpLib\Connection\AMQPStreamConnection;
8+
use PhpAmqpLib\Message\AMQPMessage;
9+
10+
$exchange = 'router';
11+
$queue = 'msgs';
12+
13+
$connection = new AMQPStreamConnection(HOST, PORT, USER, PASS, VHOST);
14+
$channel = $connection->channel();
15+
16+
/*
17+
The following code is the same both in the consumer and the producer.
18+
In this way we are sure we always have a queue to consume from and an
19+
exchange where to publish messages.
20+
*/
21+
22+
/*
23+
name: $queue
24+
passive: false
25+
durable: true // the queue will survive server restarts
26+
exclusive: false // the queue can be accessed in other channels
27+
auto_delete: false //the queue won't be deleted once the channel is closed.
28+
*/
29+
$channel->queue_declare($queue, false, true, false, false);
30+
31+
/*
32+
name: $exchange
33+
type: direct
34+
passive: false
35+
durable: true // the exchange will survive server restarts
36+
auto_delete: false //the exchange won't be deleted once the channel is closed.
37+
*/
38+
39+
$channel->exchange_declare($exchange, 'direct', false, true, false);
40+
41+
$channel->queue_bind($queue, $exchange);
42+
43+
$messageBody = implode(' ', array_slice($argv, 1));
44+
$message = new AMQPMessage($messageBody, array('content_type' => 'text/plain', 'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT));
45+
$channel->basic_publish($message, $exchange);
46+
47+
$channel->close();
48+
$connection->close();

app/demo/composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": {
3+
"php-amqplib/php-amqplib": "2.7.*"
4+
}
5+
}

app/demo/config.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
// from https://github.com/php-amqplib/php-amqplib demo
4+
5+
require_once __DIR__ . '/vendor/autoload.php';
6+
7+
define('HOST', 'rabbitmq');
8+
define('PORT', 5672);
9+
define('USER', 'guest');
10+
define('PASS', 'guest');
11+
define('VHOST', '/');
12+
13+
//If this is enabled you can see AMQP output on the CLI
14+
define('AMQP_DEBUG', true);

app/demo/rabbitmq.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
require_once __DIR__.'/vendor/autoload.php';
3+
use PhpAmqpLib\Connection\AMQPStreamConnection;
4+
use PhpAmqpLib\Message\AMQPMessage;

0 commit comments

Comments
 (0)