Skip to content

Commit f8c5cf7

Browse files
authored
Bump RabbitMQ adaptor version (#40)
* Bump RabbitMQ adaptor version * Use adaptor 0.3.3 version * Fix serialization format
1 parent a5924f3 commit f8c5cf7

File tree

6 files changed

+167
-93
lines changed

6 files changed

+167
-93
lines changed

Cargo.lock

Lines changed: 153 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parity/cli/mod.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -557,13 +557,9 @@ usage! {
557557
"Specify custom API set available via JSON-RPC over IPC using a comma-delimited list of API names. Possible names are: all, safe, web3, net, eth, pubsub, personal, signer, parity, parity_pubsub, parity_accounts, parity_set, traces, rpc, secretstore, shh, shh_pubsub. You can also disable a specific API by putting '-' in the front, example: all,-personal. 'safe' enables the following APIs: web3, net, eth, pubsub, parity, parity_pubsub, traces, rpc, shh, shh_pubsub",
558558

559559
["API and Console Options – RabbitMQ"]
560-
ARG arg_rabbitmq_hostname: (String) = "localhost", or |c: &Config| c.rabbitmq.as_ref()?.hostname.clone(),
561-
"--rabbitmq-hostname=[IP]",
562-
"Specify the RabbitMQ server hostname",
563-
564-
ARG arg_rabbitmq_port: (u16) = 5672u16, or |c: &Config| c.rabbitmq.as_ref()?.port.clone(),
565-
"--rabbitmq-port=[PORT]",
566-
"Specify the RabbitMQ server port",
560+
ARG arg_rabbitmq_uri: (String) = "amqp://localhost:5672", or |c: &Config| c.rabbitmq.as_ref()?.uri.clone(),
561+
"--rabbitmq-uri=[URI]",
562+
"Specify the RabbitMQ server uri",
567563

568564
["API and Console Options – IPFS"]
569565
FLAG flag_ipfs_api: (bool) = false, or |c: &Config| c.ipfs.as_ref()?.enable.clone(),
@@ -1281,8 +1277,7 @@ struct Ipc {
12811277
#[derive(Default, Debug, PartialEq, Deserialize)]
12821278
#[serde(deny_unknown_fields)]
12831279
struct RabbitMQ {
1284-
hostname: Option<String>,
1285-
port: Option<u16>,
1280+
uri: Option<String>,
12861281
}
12871282

12881283
#[derive(Default, Debug, PartialEq, Deserialize)]
@@ -1750,8 +1745,7 @@ mod tests {
17501745
arg_ipc_apis: "web3,eth,net,parity,parity_accounts,personal,traces,rpc,secretstore".into(),
17511746

17521747
// RabbitMQ
1753-
arg_rabbitmq_hostname: "localhost".into(),
1754-
arg_rabbitmq_port: 5672u16,
1748+
arg_rabbitmq_uri: "amqp://localhost:5672".into(),
17551749

17561750
// DAPPS
17571751
arg_dapps_path: Some("$HOME/.parity/dapps".into()),
@@ -2025,8 +2019,7 @@ mod tests {
20252019
apis: Some(vec!["rpc".into(), "eth".into()]),
20262020
}),
20272021
rabbitmq: Some(RabbitMQ {
2028-
hostname: Some("localhost".into()),
2029-
port: Some(5672),
2022+
uri: Some("amqp://localhost:5672".into()),
20302023
}),
20312024
dapps: Some(Dapps {
20322025
_legacy_disable: None,

parity/cli/tests/config.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ port = 8180
3636
apis = ["rpc", "eth"]
3737

3838
[rabbitmq]
39-
hostname = "localhost"
40-
port = 5672
39+
uri = "amqp://localhost:5672"
4140

4241
[dapps]
4342
port = 8080

parity/configuration.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,7 @@ impl Configuration {
756756

757757
fn rabbitmq_config(&self) -> RabbitMqConfig {
758758
RabbitMqConfig {
759-
hostname: self.args.arg_rabbitmq_hostname.clone(),
760-
port: self.args.arg_rabbitmq_port
759+
uri: self.args.arg_rabbitmq_uri.clone()
761760
}
762761
}
763762

@@ -1423,8 +1422,7 @@ mod tests {
14231422
ipc_conf: Default::default(),
14241423
net_conf: default_network_config(),
14251424
rabbitmq_conf: RabbitMqConfig {
1426-
hostname: "localhost".into(),
1427-
port: 5672,
1425+
uri: "amqp://localhost:5672".into(),
14281426
},
14291427
network_id: None,
14301428
warp_sync: true,

rabbitmq/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ common-types = { path = "../ethcore/types" }
2222
ethereum-types = "0.4"
2323
futures-executor = "0.2.1"
2424
parity-runtime = { path = "../util/runtime" }
25-
rabbitmq_adaptor = {version = "0.3.1", registry = "chronicled-platform-v2"}
25+
rabbitmq_adaptor = {version = "0.3.3", registry = "chronicled-platform-v2"}
2626
rlp = { version = "0.3.0", features = ["ethereum"] }
2727

2828
[dev-dependencies]

rabbitmq/src/client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use failure::{format_err, Error};
99
use futures::future::{err, lazy};
1010
use handler::{Handler, Sender};
1111
use parity_runtime::Executor;
12-
use rabbitmq_adaptor::{ConsumerResult, DeliveryExt, RabbitConnection, RabbitExt};
12+
use rabbitmq_adaptor::{ConfigUri, ConsumerResult, DeliveryExt, RabbitConnection, RabbitExt};
1313
use serde::Deserialize;
1414
use serde_json;
1515
use std::sync::Arc;
@@ -29,8 +29,7 @@ use TX_ERROR_ROUTING_KEY;
2929

3030
#[derive(Debug, Default, Clone, PartialEq)]
3131
pub struct RabbitMqConfig {
32-
pub hostname: String,
33-
pub port: u16,
32+
pub uri: String,
3433
}
3534

3635
/// Eth PubSub implementation.
@@ -67,9 +66,10 @@ impl<C: 'static + miner::BlockChainClient + BlockChainClient> PubSubClient<C> {
6766
) -> Result<Self, Error> {
6867
let (sender, receiver) = channel::<Vec<u8>>(DEFAULT_CHANNEL_SIZE);
6968
let sender_handler = Box::new(Sender::new(client.clone(), miner.clone()));
69+
let config_uri = ConfigUri::Uri(config.uri);
7070

7171
executor.spawn(lazy(move || {
72-
let rabbit = RabbitConnection::new(&config.hostname, config.port, DEFAULT_REPLY_QUEUE);
72+
let rabbit = RabbitConnection::new(config_uri, None, DEFAULT_REPLY_QUEUE);
7373
// Consume to public transaction messages
7474
try_spawn(
7575
rabbit

0 commit comments

Comments
 (0)