new port: net/rabbiteer: amqp/rabbitmq command-line tool

Send and receive messages via a RabbitMQ message broker

Approved by:	jrm (mentor)
Differential Revision:	https://reviews.freebsd.org/D17558
This commit is contained in:
Dave Cottlehuber 2018-10-23 22:32:09 +00:00
parent 91ff2c8ea9
commit f56a628d46
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=482874
13 changed files with 1535 additions and 0 deletions

View file

@ -1185,6 +1185,7 @@
SUBDIR += queso
SUBDIR += quiterss
SUBDIR += quoted
SUBDIR += rabbiteer
SUBDIR += rabbitmq
SUBDIR += rabbitmq-c
SUBDIR += rabbitmq-c-devel

103
net/rabbiteer/Makefile Normal file
View file

@ -0,0 +1,103 @@
# $FreeBSD$
PORTNAME= rabbiteer
DISTVERSION= 1.4.1
CATEGORIES= net
MAINTAINER= dch@FreeBSD.org
COMMENT= AMQP & RabbitMQ command-line tool
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENCE-MIT
USES= cargo ssl
USE_GITHUB= yes
GH_ACCOUNT= algesten
GH_PROJECT= ${PORTNAME}-rs
GH_TAGNAME= c881238
CARGO_CRATES= aho-corasick-0.5.3 \
amq-proto-0.1.0 \
amqp-0.1.1 \
ansi_term-0.11.0 \
atty-0.2.11 \
backtrace-0.3.9 \
backtrace-sys-0.1.24 \
bit-vec-0.4.4 \
bitflags-0.7.1 \
bitflags-1.0.4 \
byteorder-0.5.3 \
cc-1.0.24 \
cfg-if-0.1.5 \
clap-2.32.0 \
cloudabi-0.0.3 \
conduit-mime-types-0.7.3 \
enum_primitive-0.1.1 \
env_logger-0.3.5 \
error-chain-0.10.0 \
fuchsia-zircon-0.3.3 \
fuchsia-zircon-sys-0.3.3 \
gcc-0.3.55 \
gdi32-sys-0.2.0 \
idna-0.1.5 \
kernel32-sys-0.2.2 \
lazy_static-0.2.11 \
libc-0.2.43 \
libressl-pnacl-sys-2.1.6 \
log-0.3.9 \
log-0.4.5 \
matches-0.1.8 \
memchr-0.1.11 \
num-traits-0.1.43 \
num-traits-0.2.5 \
openssl-0.7.14 \
openssl-sys-0.7.17 \
openssl-sys-extras-0.7.14 \
percent-encoding-1.0.1 \
pkg-config-0.3.14 \
pnacl-build-helper-1.4.11 \
rand-0.4.3 \
rand-0.5.5 \
rand_core-0.2.1 \
redox_syscall-0.1.40 \
redox_termios-0.1.1 \
regex-0.1.80 \
regex-syntax-0.3.9 \
remove_dir_all-0.5.1 \
rustc-demangle-0.1.9 \
rustc-serialize-0.3.24 \
same-file-0.1.3 \
strsim-0.7.0 \
tempdir-0.3.7 \
termion-1.5.1 \
textwrap-0.10.0 \
thread-id-2.0.0 \
thread_local-0.2.7 \
unicode-bidi-0.3.4 \
unicode-normalization-0.1.7 \
unicode-width-0.1.5 \
url-1.7.1 \
user32-sys-0.2.0 \
utf8-ranges-0.1.3 \
vec_map-0.8.1 \
walkdir-1.0.7 \
winapi-0.2.8 \
winapi-0.3.5 \
winapi-build-0.1.1 \
winapi-i686-pc-windows-gnu-0.4.0 \
winapi-x86_64-pc-windows-gnu-0.4.0
PLIST_FILES= bin/rabbiteer
PORTDOCS= README.md
OPTIONS_DEFINE= DOCS
post-install:
@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/rabbiteer
post-install-DOCS-on:
(cd ${WRKSRC} && ${COPYTREE_SHARE} README.md ${STAGEDIR}${DOCSDIR})
.include <bsd.port.mk>

143
net/rabbiteer/distinfo Normal file
View file

@ -0,0 +1,143 @@
TIMESTAMP = 1539546799
SHA256 (rust/crates/aho-corasick-0.5.3.tar.gz) = ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66
SIZE (rust/crates/aho-corasick-0.5.3.tar.gz) = 252052
SHA256 (rust/crates/amq-proto-0.1.0.tar.gz) = 66d79639b71f74c7006c12683cc2ff221615a51a741688fa7798ccd080dc54d3
SIZE (rust/crates/amq-proto-0.1.0.tar.gz) = 14517
SHA256 (rust/crates/amqp-0.1.1.tar.gz) = e1a60ccc700b6a79480c8ee0140f231db4a23b7b6ff18581f84f7091f6bbcce4
SIZE (rust/crates/amqp-0.1.1.tar.gz) = 19709
SHA256 (rust/crates/ansi_term-0.11.0.tar.gz) = ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b
SIZE (rust/crates/ansi_term-0.11.0.tar.gz) = 17087
SHA256 (rust/crates/atty-0.2.11.tar.gz) = 9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652
SIZE (rust/crates/atty-0.2.11.tar.gz) = 5916
SHA256 (rust/crates/backtrace-0.3.9.tar.gz) = 89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a
SIZE (rust/crates/backtrace-0.3.9.tar.gz) = 31054
SHA256 (rust/crates/backtrace-sys-0.1.24.tar.gz) = c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0
SIZE (rust/crates/backtrace-sys-0.1.24.tar.gz) = 522332
SHA256 (rust/crates/bit-vec-0.4.4.tar.gz) = 02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f
SIZE (rust/crates/bit-vec-0.4.4.tar.gz) = 17895
SHA256 (rust/crates/bitflags-0.7.1.tar.gz) = ab1c7dc97f39523ffa63f3096291612e630cf3ed75aa6b9fad436bac4c700274
SIZE (rust/crates/bitflags-0.7.1.tar.gz) = 11121
SHA256 (rust/crates/bitflags-1.0.4.tar.gz) = 228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12
SIZE (rust/crates/bitflags-1.0.4.tar.gz) = 15282
SHA256 (rust/crates/byteorder-0.5.3.tar.gz) = 0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855
SIZE (rust/crates/byteorder-0.5.3.tar.gz) = 8643
SHA256 (rust/crates/cc-1.0.24.tar.gz) = 70f2a88c2e69ceee91c209d8ef25b81fc1a65f42c7f14dfd59d1fed189e514d1
SIZE (rust/crates/cc-1.0.24.tar.gz) = 43132
SHA256 (rust/crates/cfg-if-0.1.5.tar.gz) = 0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3
SIZE (rust/crates/cfg-if-0.1.5.tar.gz) = 7363
SHA256 (rust/crates/clap-2.32.0.tar.gz) = b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e
SIZE (rust/crates/clap-2.32.0.tar.gz) = 196073
SHA256 (rust/crates/cloudabi-0.0.3.tar.gz) = ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f
SIZE (rust/crates/cloudabi-0.0.3.tar.gz) = 22156
SHA256 (rust/crates/conduit-mime-types-0.7.3.tar.gz) = 95ca30253581af809925ef68c2641cc140d6183f43e12e0af4992d53768bd7b8
SIZE (rust/crates/conduit-mime-types-0.7.3.tar.gz) = 15889
SHA256 (rust/crates/enum_primitive-0.1.1.tar.gz) = be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180
SIZE (rust/crates/enum_primitive-0.1.1.tar.gz) = 4186
SHA256 (rust/crates/env_logger-0.3.5.tar.gz) = 15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f
SIZE (rust/crates/env_logger-0.3.5.tar.gz) = 5950
SHA256 (rust/crates/error-chain-0.10.0.tar.gz) = d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8
SIZE (rust/crates/error-chain-0.10.0.tar.gz) = 18432
SHA256 (rust/crates/fuchsia-zircon-0.3.3.tar.gz) = 2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82
SIZE (rust/crates/fuchsia-zircon-0.3.3.tar.gz) = 22565
SHA256 (rust/crates/fuchsia-zircon-sys-0.3.3.tar.gz) = 3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7
SIZE (rust/crates/fuchsia-zircon-sys-0.3.3.tar.gz) = 7191
SHA256 (rust/crates/gcc-0.3.55.tar.gz) = 8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2
SIZE (rust/crates/gcc-0.3.55.tar.gz) = 37262
SHA256 (rust/crates/gdi32-sys-0.2.0.tar.gz) = 0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518
SIZE (rust/crates/gdi32-sys-0.2.0.tar.gz) = 7643
SHA256 (rust/crates/idna-0.1.5.tar.gz) = 38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e
SIZE (rust/crates/idna-0.1.5.tar.gz) = 258735
SHA256 (rust/crates/kernel32-sys-0.2.2.tar.gz) = 7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d
SIZE (rust/crates/kernel32-sys-0.2.2.tar.gz) = 24537
SHA256 (rust/crates/lazy_static-0.2.11.tar.gz) = 76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73
SIZE (rust/crates/lazy_static-0.2.11.tar.gz) = 12361
SHA256 (rust/crates/libc-0.2.43.tar.gz) = 76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d
SIZE (rust/crates/libc-0.2.43.tar.gz) = 353810
SHA256 (rust/crates/libressl-pnacl-sys-2.1.6.tar.gz) = cbc058951ab6a3ef35ca16462d7642c4867e6403520811f28537a4e2f2db3e71
SIZE (rust/crates/libressl-pnacl-sys-2.1.6.tar.gz) = 2697179
SHA256 (rust/crates/log-0.3.9.tar.gz) = e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b
SIZE (rust/crates/log-0.3.9.tar.gz) = 16686
SHA256 (rust/crates/log-0.4.5.tar.gz) = d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f
SIZE (rust/crates/log-0.4.5.tar.gz) = 22221
SHA256 (rust/crates/matches-0.1.8.tar.gz) = 7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08
SIZE (rust/crates/matches-0.1.8.tar.gz) = 2216
SHA256 (rust/crates/memchr-0.1.11.tar.gz) = d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20
SIZE (rust/crates/memchr-0.1.11.tar.gz) = 6977
SHA256 (rust/crates/num-traits-0.1.43.tar.gz) = 92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31
SIZE (rust/crates/num-traits-0.1.43.tar.gz) = 7659
SHA256 (rust/crates/num-traits-0.2.5.tar.gz) = 630de1ef5cc79d0cdd78b7e33b81f083cbfe90de0f4b2b2f07f905867c70e9fe
SIZE (rust/crates/num-traits-0.2.5.tar.gz) = 39136
SHA256 (rust/crates/openssl-0.7.14.tar.gz) = c4117b6244aac42ed0150a6019b4d953d28247c5dd6ae6f46ae469b5f2318733
SIZE (rust/crates/openssl-0.7.14.tar.gz) = 63824
SHA256 (rust/crates/openssl-sys-0.7.17.tar.gz) = 89c47ee94c352eea9ddaf8e364be7f978a3bb6d66d73176572484238dd5a5c3f
SIZE (rust/crates/openssl-sys-0.7.17.tar.gz) = 12097
SHA256 (rust/crates/openssl-sys-extras-0.7.14.tar.gz) = 11c5e1dba7d3d03d80f045bf0d60111dc69213b67651e7c889527a3badabb9fa
SIZE (rust/crates/openssl-sys-extras-0.7.14.tar.gz) = 3871
SHA256 (rust/crates/percent-encoding-1.0.1.tar.gz) = 31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831
SIZE (rust/crates/percent-encoding-1.0.1.tar.gz) = 10057
SHA256 (rust/crates/pkg-config-0.3.14.tar.gz) = 676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c
SIZE (rust/crates/pkg-config-0.3.14.tar.gz) = 13565
SHA256 (rust/crates/pnacl-build-helper-1.4.11.tar.gz) = dfbe13ee77c06fb633d71c72438bd983286bb3521863a753ade8e951c7efb090
SIZE (rust/crates/pnacl-build-helper-1.4.11.tar.gz) = 5447
SHA256 (rust/crates/rand-0.4.3.tar.gz) = 8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd
SIZE (rust/crates/rand-0.4.3.tar.gz) = 76094
SHA256 (rust/crates/rand-0.5.5.tar.gz) = e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c
SIZE (rust/crates/rand-0.5.5.tar.gz) = 137359
SHA256 (rust/crates/rand_core-0.2.1.tar.gz) = edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2
SIZE (rust/crates/rand_core-0.2.1.tar.gz) = 19262
SHA256 (rust/crates/redox_syscall-0.1.40.tar.gz) = c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1
SIZE (rust/crates/redox_syscall-0.1.40.tar.gz) = 14745
SHA256 (rust/crates/redox_termios-0.1.1.tar.gz) = 7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76
SIZE (rust/crates/redox_termios-0.1.1.tar.gz) = 3227
SHA256 (rust/crates/regex-0.1.80.tar.gz) = 4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f
SIZE (rust/crates/regex-0.1.80.tar.gz) = 185806
SHA256 (rust/crates/regex-syntax-0.3.9.tar.gz) = f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957
SIZE (rust/crates/regex-syntax-0.3.9.tar.gz) = 117427
SHA256 (rust/crates/remove_dir_all-0.5.1.tar.gz) = 3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5
SIZE (rust/crates/remove_dir_all-0.5.1.tar.gz) = 8726
SHA256 (rust/crates/rustc-demangle-0.1.9.tar.gz) = bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395
SIZE (rust/crates/rustc-demangle-0.1.9.tar.gz) = 11463
SHA256 (rust/crates/rustc-serialize-0.3.24.tar.gz) = dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda
SIZE (rust/crates/rustc-serialize-0.3.24.tar.gz) = 45926
SHA256 (rust/crates/same-file-0.1.3.tar.gz) = d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7
SIZE (rust/crates/same-file-0.1.3.tar.gz) = 7078
SHA256 (rust/crates/strsim-0.7.0.tar.gz) = bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550
SIZE (rust/crates/strsim-0.7.0.tar.gz) = 8435
SHA256 (rust/crates/tempdir-0.3.7.tar.gz) = 15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8
SIZE (rust/crates/tempdir-0.3.7.tar.gz) = 11468
SHA256 (rust/crates/termion-1.5.1.tar.gz) = 689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096
SIZE (rust/crates/termion-1.5.1.tar.gz) = 20659
SHA256 (rust/crates/textwrap-0.10.0.tar.gz) = 307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6
SIZE (rust/crates/textwrap-0.10.0.tar.gz) = 15986
SHA256 (rust/crates/thread-id-2.0.0.tar.gz) = a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03
SIZE (rust/crates/thread-id-2.0.0.tar.gz) = 6108
SHA256 (rust/crates/thread_local-0.2.7.tar.gz) = 8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5
SIZE (rust/crates/thread_local-0.2.7.tar.gz) = 10954
SHA256 (rust/crates/unicode-bidi-0.3.4.tar.gz) = 49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5
SIZE (rust/crates/unicode-bidi-0.3.4.tar.gz) = 32228
SHA256 (rust/crates/unicode-normalization-0.1.7.tar.gz) = 6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25
SIZE (rust/crates/unicode-normalization-0.1.7.tar.gz) = 330545
SHA256 (rust/crates/unicode-width-0.1.5.tar.gz) = 882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526
SIZE (rust/crates/unicode-width-0.1.5.tar.gz) = 15761
SHA256 (rust/crates/url-1.7.1.tar.gz) = 2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6
SIZE (rust/crates/url-1.7.1.tar.gz) = 68266
SHA256 (rust/crates/user32-sys-0.2.0.tar.gz) = 4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47
SIZE (rust/crates/user32-sys-0.2.0.tar.gz) = 10624
SHA256 (rust/crates/utf8-ranges-0.1.3.tar.gz) = a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f
SIZE (rust/crates/utf8-ranges-0.1.3.tar.gz) = 8422
SHA256 (rust/crates/vec_map-0.8.1.tar.gz) = 05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a
SIZE (rust/crates/vec_map-0.8.1.tar.gz) = 14959
SHA256 (rust/crates/walkdir-1.0.7.tar.gz) = bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff
SIZE (rust/crates/walkdir-1.0.7.tar.gz) = 17883
SHA256 (rust/crates/winapi-0.2.8.tar.gz) = 167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a
SIZE (rust/crates/winapi-0.2.8.tar.gz) = 455145
SHA256 (rust/crates/winapi-0.3.5.tar.gz) = 773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd
SIZE (rust/crates/winapi-0.3.5.tar.gz) = 997942
SHA256 (rust/crates/winapi-build-0.1.1.tar.gz) = 2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc
SIZE (rust/crates/winapi-build-0.1.1.tar.gz) = 669
SHA256 (rust/crates/winapi-i686-pc-windows-gnu-0.4.0.tar.gz) = ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6
SIZE (rust/crates/winapi-i686-pc-windows-gnu-0.4.0.tar.gz) = 2918815
SHA256 (rust/crates/winapi-x86_64-pc-windows-gnu-0.4.0.tar.gz) = 712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f
SIZE (rust/crates/winapi-x86_64-pc-windows-gnu-0.4.0.tar.gz) = 2947998
SHA256 (algesten-rabbiteer-rs-1.4.1-c881238_GH0.tar.gz) = 882450472ee00e5848c59c75c0eba1b07ffb2dc0d1ab494608930c474e457123
SIZE (algesten-rabbiteer-rs-1.4.1-c881238_GH0.tar.gz) = 14909

282
net/rabbiteer/files/patch-Cargo.lock generated Normal file
View file

@ -0,0 +1,282 @@
--- Cargo.lock.orig 2018-10-14 19:59:45 UTC
+++ Cargo.lock
@@ -27,6 +27,7 @@ dependencies = [
"amq-proto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -76,6 +77,11 @@ source = "registry+https://github.com/rust-lang/crates
[[package]]
name = "bitflags"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "bitflags"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -164,6 +170,20 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "gcc"
+version = "0.3.55"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "gdi32-sys"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "idna"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -183,11 +203,24 @@ dependencies = [
]
[[package]]
+name = "lazy_static"
+version = "0.2.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "libc"
version = "0.2.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "libressl-pnacl-sys"
+version = "2.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "pnacl-build-helper 1.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "log"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -230,11 +263,60 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "openssl"
+version = "0.7.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "bitflags 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "openssl-sys"
+version = "0.7.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "openssl-sys-extras"
+version = "0.7.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "percent-encoding"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "pkg-config"
+version = "0.3.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "pnacl-build-helper"
+version = "1.4.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "rabbiteer"
version = "1.4.1"
dependencies = [
@@ -248,6 +330,16 @@ dependencies = [
[[package]]
name = "rand"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "rand"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
@@ -294,6 +386,14 @@ version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "remove_dir_all"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "rustc-demangle"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -304,11 +404,29 @@ version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "same-file"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "strsim"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "tempdir"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "termion"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -372,6 +490,15 @@ dependencies = [
]
[[package]]
+name = "user32-sys"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "utf8-ranges"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -382,6 +509,16 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "walkdir"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -419,6 +556,7 @@ source = "registry+https://github.com/rust-lang/crates
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f"
+"checksum bitflags 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab1c7dc97f39523ffa63f3096291612e630cf3ed75aa6b9fad436bac4c700274"
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
"checksum cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "70f2a88c2e69ceee91c209d8ef25b81fc1a65f42c7f14dfd59d1fed189e514d1"
@@ -431,25 +569,38 @@ source = "registry+https://github.com/rust-lang/crates
"checksum error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
+"checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
+"checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518"
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
+"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
+"checksum libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "cbc058951ab6a3ef35ca16462d7642c4867e6403520811f28537a4e2f2db3e71"
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f"
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
"checksum num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "630de1ef5cc79d0cdd78b7e33b81f083cbfe90de0f4b2b2f07f905867c70e9fe"
+"checksum openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "c4117b6244aac42ed0150a6019b4d953d28247c5dd6ae6f46ae469b5f2318733"
+"checksum openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)" = "89c47ee94c352eea9ddaf8e364be7f978a3bb6d66d73176572484238dd5a5c3f"
+"checksum openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "11c5e1dba7d3d03d80f045bf0d60111dc69213b67651e7c889527a3badabb9fa"
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
+"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
+"checksum pnacl-build-helper 1.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dfbe13ee77c06fb633d71c72438bd983286bb3521863a753ade8e951c7efb090"
+"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
"checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2"
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f"
"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957"
+"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395"
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
+"checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
+"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
@@ -458,8 +609,10 @@ source = "registry+https://github.com/rust-lang/crates
"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25"
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
"checksum url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6"
+"checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47"
"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
+"checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"

View file

@ -0,0 +1,17 @@
--- Cargo.toml.orig 2018-10-14 19:59:53 UTC
+++ Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rabbiteer"
-version = "1.4.1"
+version = "1.4.1"
authors = ["Martin Algesten <martin@algesten.se>"]
description = "AMQP/RabbitMQ input/output CLI tool"
repository = "https://github.com/algesten/rabbiteer-rs"
@@ -20,4 +20,5 @@ url = "1"
#branch = "rabbiteer"
#path = "/Users/martin/dev/_dist/rust-amqp"
version = "0.1"
-default-features = false
+# commented out so we have TLS-enabled AMQP via OpenSSL
+# default-features = false

View file

@ -0,0 +1,20 @@
--- README.md.orig 2018-10-14 19:59:57 UTC
+++ README.md
@@ -77,7 +77,7 @@ Publishing pushes data from stdin or a file to an exch
OPTIONS:
-c, --content-type <content_type> Content type such as application/json. Inferred from filename if
possible.
- -e, --exchange <exchange> Exchange to publish to [default ]
+ -e, --exchange <exchange> Exchange to publish to [default ""]
-f, --file <file> Filename (- is stdin) [default: -]
-H, --header <header>... Header on the form "My-Header: Value"
-r, --routing-key <routing_key> Routing key [default: ]
@@ -120,7 +120,7 @@ stdout or as files to a directory.
FLAGS:
-i, --info Include delivery info (and headers).
OPTIONS:
- -e, --exchange <exchange> Exchange to subscribe to
+ -e, --exchange <exchange> Exchange to subscribe to [default ""]
-o, --output <output> Output directory (- is stdout) [default: -]
-r, --routing-key <routing_key> Routing key [default: #]

View file

@ -0,0 +1,266 @@
--- src/client.rs.orig 2018-10-14 20:00:28 UTC
+++ src/client.rs
@@ -1,14 +1,14 @@
-use std::io;
-use error::RbtError;
-use amqp::{self, Session, Options, Channel};
-use amqp::protocol::basic::{Deliver, BasicProperties};
+use amqp::protocol::basic::{BasicProperties, Deliver};
use amqp::Basic;
+use amqp::{self, Channel, Options, Session};
use amqp::{Table, TableEntry};
+use error::RbtError;
+use std::io;
+use std::error::Error;
+use std::sync::mpsc;
use std::thread;
use std::time::Duration;
-use std::sync::mpsc;
-use std::error::Error;
pub struct Sendable {
pub exchange: String,
@@ -18,21 +18,20 @@ pub struct Sendable {
pub file_name: String,
pub reader: Box<io::Read>,
pub priority: u8,
- pub rpctimeout: u64
+ pub rpctimeout: u64,
}
-pub type ReceiveCb = FnMut(&mut Channel, Deliver, BasicProperties, Vec<u8>) -> Result<(), RbtError> + Send;
+pub type ReceiveCb =
+ FnMut(&mut Channel, Deliver, BasicProperties, Vec<u8>) -> Result<(), RbtError> + Send;
pub struct Receiver {
- pub exchange:String,
+ pub exchange: String,
pub routing_key: Option<String>,
pub auto_ack: bool,
- pub callback:Box<ReceiveCb>,
+ pub callback: Box<ReceiveCb>,
}
-
-pub fn open_send(o:Options, s:Sendable, r:Option<Receiver>) -> Result<(),RbtError> {
-
+pub fn open_send(o: Options, s: Sendable, r: Option<Receiver>) -> Result<(), RbtError> {
// open the channel
let (mut session, mut channel) = _open(o)?;
@@ -49,7 +48,10 @@ pub fn open_send(o:Options, s:Sendable, r:Option<Recei
// put filename in headers if we read from file
if s.file_name != "-" && !headers.contains_key("fileName") {
- headers.insert("fileName".to_owned(), TableEntry::LongString(String::from(s.file_name)));
+ headers.insert(
+ "fileName".to_owned(),
+ TableEntry::LongString(String::from(s.file_name)),
+ );
}
// send properties
@@ -73,8 +75,8 @@ pub fn open_send(o:Options, s:Sendable, r:Option<Recei
props.correlation_id = Some("rabbiteer here".to_owned());
true
- },
- None => false
+ }
+ None => false,
};
// read input input buffer
@@ -87,12 +89,14 @@ pub fn open_send(o:Options, s:Sendable, r:Option<Recei
if isrpc {
let (tx, rx) = mpsc::channel();
- thread::Builder::new().name("consumer_thread".to_string()).spawn(move || {
- channel.start_consuming();
- tx.send(channel).unwrap();
- }).unwrap();
+ thread::Builder::new()
+ .name("consumer_thread".to_string())
+ .spawn(move || {
+ channel.start_consuming();
+ tx.send(channel).unwrap();
+ })
+ .unwrap();
-
let timeout = s.rpctimeout;
if timeout == 0 {
// Block forever until recieve
@@ -103,7 +107,7 @@ pub fn open_send(o:Options, s:Sendable, r:Option<Recei
match res {
Ok(mut ch) => {
ch.close(200, "Bye")?;
- }
+ }
Err(err) => {
if err.description() == "timed out waiting on channel".to_string() {
println!("Error timeout");
@@ -121,10 +125,9 @@ pub fn open_send(o:Options, s:Sendable, r:Option<Recei
Ok(())
}
-
// narrow the string to a TableEntry type by trying to parse to known
// JSON types: bool, double and fall back on string.
-fn narrow(str:&str) -> TableEntry {
+fn narrow(str: &str) -> TableEntry {
let boolv = str.parse::<bool>();
if !boolv.is_err() {
TableEntry::Bool(boolv.unwrap())
@@ -138,19 +141,22 @@ fn narrow(str:&str) -> TableEntry {
}
}
-
-fn _open(o:Options) -> Result<(Session, Channel),RbtError> {
-// errln!("Connecting to amqp://{}:{}@{}:{}/{}",
-// o.login, o.password, o.host, o.port, o.vhost);
+fn _open(o: Options) -> Result<(Session, Channel), RbtError> {
+ // errln!("Connecting to amqp://{}:{}@{}:{}/{}",
+ // o.login, o.password, o.host, o.port, o.vhost);
let mut session = Session::new(o)?;
let channel = session.open_channel(1)?;
Ok((session, channel))
}
impl amqp::Consumer for Receiver {
- fn handle_delivery(&mut self, channel:&mut Channel, deliver:Deliver,
- headers:BasicProperties, body:Vec<u8>){
-
+ fn handle_delivery(
+ &mut self,
+ channel: &mut Channel,
+ deliver: Deliver,
+ headers: BasicProperties,
+ body: Vec<u8>,
+ ) {
let delivery_tag = deliver.delivery_tag.clone();
if self.auto_ack {
@@ -160,12 +166,15 @@ impl amqp::Consumer for Receiver {
// and deliver to callback
((self.callback)(channel, deliver, headers, body)).unwrap_or_else(::error::handle);
-
}
}
-pub fn open_receive(o:Options, q:Option<String>, force_declare: bool, r:Receiver) -> Result<(),RbtError> {
-
+pub fn open_receive(
+ o: Options,
+ q: Option<String>,
+ force_declare: bool,
+ r: Receiver,
+) -> Result<(), RbtError> {
// open session/channel
let (_, mut channel) = _open(o)?;
@@ -178,22 +187,33 @@ pub fn open_receive(o:Options, q:Option<String>, force
Ok(())
}
-
-fn do_open_receive(channel:&mut Channel, q:Option<String>, force_declare: bool, r:Receiver) -> Result<String,RbtError> {
-
+fn do_open_receive(
+ channel: &mut Channel,
+ q: Option<String>,
+ force_declare: bool,
+ r: Receiver,
+) -> Result<String, RbtError> {
let mut auto_delete = false;
let mut bind_routing_key = r.routing_key.clone();
-
+
let queue_name = match q {
Some(q) => {
// Force the declaration of this queue
if force_declare {
// queue, passive, durable, exclusive, auto_delete, nowait, arguments
- let queue_declare = channel.queue_declare(q, false, false, auto_delete, auto_delete, false, Table::new())?;
+ let queue_declare = channel.queue_declare(
+ q,
+ false,
+ false,
+ auto_delete,
+ auto_delete,
+ false,
+ Table::new(),
+ )?;
// name is auto generated
queue_declare.queue
- }else{
+ } else {
q
}
}
@@ -205,25 +225,33 @@ fn do_open_receive(channel:&mut Channel, q:Option<Stri
}
// queue, passive, durable, exclusive, auto_delete, nowait, arguments
- let queue_declare =
- channel.queue_declare(
- q.clone().unwrap_or("".to_owned()) ,
- false, false,
- auto_delete, auto_delete, false, Table::new())?;
+ let queue_declare = channel.queue_declare(
+ q.clone().unwrap_or("".to_owned()),
+ false,
+ false,
+ auto_delete,
+ auto_delete,
+ false,
+ Table::new(),
+ )?;
// name is auto generated
queue_declare.queue
-
}
};
// Only bind if we have a routing key - May be an existing queue
if let Some(routing_key) = bind_routing_key {
// bind queue to the exchange, which already must be declared.
-
+
if r.exchange != "" {
- channel.queue_bind(queue_name.clone(), r.exchange.clone(), routing_key.clone(),
- false, Table::new())?;
+ channel.queue_bind(
+ queue_name.clone(),
+ r.exchange.clone(),
+ routing_key.clone(),
+ false,
+ Table::new(),
+ )?;
}
}
@@ -232,8 +260,16 @@ fn do_open_receive(channel:&mut Channel, q:Option<Stri
// start consuming the queue.
// callback, queue, consumer_tag, no_local, no_ack, exclusive, nowait, arguments
- channel.basic_consume(r, queue_name.clone(), consumer_tag, false,
- false, false, false, Table::new())?;
+ channel.basic_consume(
+ r,
+ queue_name.clone(),
+ consumer_tag,
+ false,
+ false,
+ false,
+ false,
+ Table::new(),
+ )?;
Ok(queue_name)
}

View file

@ -0,0 +1,71 @@
--- src/error.rs.orig 2018-10-14 20:00:28 UTC
+++ src/error.rs
@@ -1,10 +1,10 @@
+use amqp::AMQPError;
+use clap;
+use rustc_serialize::json;
+use std::convert::From;
use std::fmt;
use std::io;
-use std::convert::From;
-use amqp::AMQPError;
use std::string::FromUtf8Error;
-use rustc_serialize::json;
-use clap;
#[macro_export]
macro_rules! errln(
@@ -21,9 +21,8 @@ macro_rules! rbterr(
}}
);
-
pub enum RbtError {
- Message(String), // Plain error message
+ Message(String), // Plain error message
AMQP(AMQPError),
IO(io::Error),
UTF8(FromUtf8Error),
@@ -31,27 +30,24 @@ pub enum RbtError {
Clap(clap::Error),
}
-
impl fmt::Display for RbtError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
RbtError::Message(ref s) => write!(f, "Error: {}", s),
- RbtError::AMQP(ref e) => write!(f, "{}", e),
- RbtError::IO(ref e) => write!(f, "{}", e),
- RbtError::UTF8(ref e) => write!(f, "{}", e),
- RbtError::JSON(ref e) => write!(f, "{}", e),
- RbtError::Clap(ref e) => write!(f, "{}", e),
+ RbtError::AMQP(ref e) => write!(f, "{}", e),
+ RbtError::IO(ref e) => write!(f, "{}", e),
+ RbtError::UTF8(ref e) => write!(f, "{}", e),
+ RbtError::JSON(ref e) => write!(f, "{}", e),
+ RbtError::Clap(ref e) => write!(f, "{}", e),
}
}
}
-
-pub fn handle(e:RbtError) {
+pub fn handle(e: RbtError) {
errln!("{}", e);
::std::process::exit(1);
}
-
macro_rules! from(
($t:ty, $p:tt) => {
impl From<$t> for RbtError {
@@ -70,7 +66,7 @@ from!(clap::Error, Clap);
from!(String, Message);
impl From<&'static str> for RbtError {
- fn from(s:&str) -> RbtError {
+ fn from(s: &str) -> RbtError {
RbtError::Message(String::from(s))
}
}

View file

@ -0,0 +1,171 @@
--- src/main.rs.orig 2018-10-14 20:00:28 UTC
+++ src/main.rs
@@ -1,36 +1,41 @@
-extern crate rustc_serialize;
extern crate amqp;
-extern crate rand;
extern crate conduit_mime_types as mime;
+extern crate rand;
+extern crate rustc_serialize;
extern crate url;
-#[macro_use] extern crate clap;
+#[macro_use]
+extern crate clap;
-#[macro_use] mod error;
+#[macro_use]
+mod error;
mod client;
mod output;
mod publish;
mod subscribe;
+use clap::{App, Arg, SubCommand};
+use error::RbtError;
+use rustc_serialize::json::Json;
use std::env;
use std::fs;
-use clap::{Arg, App, SubCommand};
+use std::panic;
use url::Url;
-use rustc_serialize::json::Json;
-use error::RbtError;
-
fn main() {
+ panic::set_hook(Box::new(|_panic| {
+ // chill
+ }));
+
_main().unwrap_or_else(error::handle);
}
-static HOST:&'static str = "127.0.0.1";
-static PORT:&'static str = "5672";
-static USER:&'static str = "guest";
-static PASS:&'static str = "guest";
-static VHST:&'static str = "";
+static HOST: &'static str = "127.0.0.1";
+static PORT: &'static str = "5672";
+static USER: &'static str = "guest";
+static PASS: &'static str = "guest";
+static VHST: &'static str = "";
-fn _main() -> Result<(),RbtError> {
-
+fn _main() -> Result<(), RbtError> {
let matches = App::new("Rabbiteer")
.version(crate_version!())
.author("Martin Algesten <martin@algesten.se>")
@@ -124,7 +129,7 @@ fn _main() -> Result<(),RbtError> {
.short("e")
.long("exchange")
.takes_value(true)
- .required(true))
+ .default_value(""))
.arg(Arg::with_name("routing_key")
.help("Routing key")
.short("r")
@@ -167,11 +172,11 @@ fn _main() -> Result<(),RbtError> {
// start with defaults.
let mut opts = amqp::Options {
- host: value_t!(matches, "host", String)?,
- port: value_t!(matches, "port", u16)?,
- login: value_t!(matches, "user", String)?,
+ host: value_t!(matches, "host", String)?,
+ port: value_t!(matches, "port", u16)?,
+ login: value_t!(matches, "user", String)?,
password: value_t!(matches, "password", String)?,
- vhost: value_t!(matches, "vhost", String)?,
+ vhost: value_t!(matches, "vhost", String)?,
..Default::default()
};
@@ -183,7 +188,7 @@ fn _main() -> Result<(),RbtError> {
parse_url(&mut opts, urlstr)?;
}
- fn if_differs(opt:Option<&str>, def:&str, set:&mut FnMut(String) -> ()) {
+ fn if_differs(opt: Option<&str>, def: &str, set: &mut FnMut(String) -> ()) {
if let Some(v) = opt {
if v != def {
set(v.to_string());
@@ -191,44 +196,46 @@ fn _main() -> Result<(),RbtError> {
}
}
- if_differs(matches.value_of("host"), HOST, &mut|v|{ opts.host = v });
- if_differs(matches.value_of("port"), PORT, &mut|v|{ opts.port = v.parse::<u16>().unwrap() });
- if_differs(matches.value_of("user"), USER, &mut|v|{ opts.login = v });
- if_differs(matches.value_of("password"), PASS, &mut|v|{ opts.password = v });
- if_differs(matches.value_of("vhost"), VHST, &mut|v|{ opts.vhost = v });
+ if_differs(matches.value_of("host"), HOST, &mut |v| {
+ opts.host = v
+ });
+ if_differs(matches.value_of("port"), PORT, &mut |v| {
+ opts.port = v.parse::<u16>().unwrap()
+ });
+ if_differs(matches.value_of("user"), USER, &mut |v| {
+ opts.login = v
+ });
+ if_differs(matches.value_of("password"), PASS, &mut |v| {
+ opts.password = v
+ });
+ if_differs(matches.value_of("vhost"), VHST, &mut |v| {
+ opts.vhost = v
+ });
// depending on subcommand, we do one or the other
match matches.subcommand_name() {
-
// execute publish command
Some("publish") => {
-
// the args after the "publish command
let subm = matches.subcommand_matches("publish").unwrap();
publish::do_publish(opts, subm)
+ }
- },
-
// execute subscribe command
Some("subscribe") => {
-
// the args after the "subscribe" command
let subm = matches.subcommand_matches("subscribe").unwrap();
subscribe::do_subscribe(opts, subm)
+ }
- },
-
_ => rbterr!("Need subcommand. Try --help"),
}
-
}
-
-
// update the opts object with the given url
-fn parse_url(opts:&mut amqp::Options, urlstr:String) -> Result<(),RbtError> {
+fn parse_url(opts: &mut amqp::Options, urlstr: String) -> Result<(), RbtError> {
if let Ok(url) = Url::parse(urlstr.as_ref()) {
if url.scheme() != "amqp" {
rbterr!("Unknown scheme: {}", url);
@@ -256,12 +263,9 @@ fn parse_url(opts:&mut amqp::Options, urlstr:String) -
}
}
-
-
// update the opts object with the conf
-fn parse_conf(opts:&mut amqp::Options) -> bool {
-
- let mut update = |connopt:Option<&Json>| -> bool {
+fn parse_conf(opts: &mut amqp::Options) -> bool {
+ let mut update = |connopt: Option<&Json>| -> bool {
if let Some(conn) = connopt {
if conn.is_object() {
if let Json::String(ref v) = conn["host"] {

View file

@ -0,0 +1,173 @@
--- src/output.rs.orig 2018-10-14 20:00:28 UTC
+++ src/output.rs
@@ -1,10 +1,9 @@
-use rustc_serialize::json::{self, Json, Object};
-use rustc_serialize::base64::{self, ToBase64};
-use amqp::protocol::basic::{Deliver, BasicProperties};
+use amqp::protocol::basic::{BasicProperties, Deliver};
use amqp::{Table, TableEntry};
use error::RbtError;
+use rustc_serialize::base64::{self, ToBase64};
+use rustc_serialize::json::{self, Json, Object};
-
#[derive(RustcEncodable)]
struct MsgDeliver {
consumer_tag: String,
@@ -27,24 +26,27 @@ struct Msg {
data: Json,
}
-pub fn build_output(info:bool, deliver:&Deliver,
- props:&BasicProperties, body:Vec<u8>) -> Result<Vec<u8>,RbtError> {
+pub fn build_output(
+ info: bool,
+ deliver: &Deliver,
+ props: &BasicProperties,
+ body: Vec<u8>,
+) -> Result<Vec<u8>, RbtError> {
if info {
-
// delivery info
let mdel = MsgDeliver {
- consumer_tag:deliver.consumer_tag.clone(),
- delivery_tag:deliver.delivery_tag.clone(),
- redelivered:deliver.redelivered.clone(),
- exchange:deliver.exchange.clone(),
- routing_key:deliver.routing_key.clone(),
+ consumer_tag: deliver.consumer_tag.clone(),
+ delivery_tag: deliver.delivery_tag.clone(),
+ redelivered: deliver.redelivered.clone(),
+ exchange: deliver.exchange.clone(),
+ routing_key: deliver.routing_key.clone(),
};
let content_type = props.content_type.clone().unwrap_or(String::from(""));
// properties
let mut mprops = MsgProps {
- content_type:content_type.clone(),
+ content_type: content_type.clone(),
headers: Object::new(),
};
@@ -57,9 +59,9 @@ pub fn build_output(info:bool, deliver:&Deliver,
// and put it together
let msg = Msg {
- deliver:mdel,
- props:mprops,
- data:data,
+ deliver: mdel,
+ props: mprops,
+ data: data,
};
// encode
@@ -67,9 +69,7 @@ pub fn build_output(info:bool, deliver:&Deliver,
// convert to bytes
Ok(js.to_string().as_bytes().to_owned())
-
} else {
-
let content_type = props.content_type.clone().unwrap_or(String::from(""));
match content_type.as_ref() {
@@ -82,32 +82,26 @@ pub fn build_output(info:bool, deliver:&Deliver,
// convert to bytes
Ok(js.to_string().as_bytes().to_owned())
- },
+ }
// just return untranslated bytes
- _ => Ok(body)
+ _ => Ok(body),
}
-
}
}
-
-fn figure_out_body(content_type:String, body:Vec<u8>) -> Result<Json,RbtError> {
-
+fn figure_out_body(content_type: String, body: Vec<u8>) -> Result<Json, RbtError> {
// depending on content type, do something
match content_type.as_ref() {
"application/json" => Ok(Json::from_str(&String::from_utf8(body)?)?),
_ => Ok(match content_type.find("text/") {
Some(_) => Json::String(String::from_utf8(body)?),
- _ => Json::String(body.to_base64(base64::STANDARD))
- })
+ _ => Json::String(body.to_base64(base64::STANDARD)),
+ }),
}
-
}
-
-
-fn table_to_json(table:&Table) -> Object {
+fn table_to_json(table: &Table) -> Object {
let mut ret = Object::new();
for (skey, entry) in table {
ret.insert(skey.clone().to_string(), entry_to_json(&entry));
@@ -115,33 +109,35 @@ fn table_to_json(table:&Table) -> Object {
ret
}
-fn entry_to_json(entry:&TableEntry) -> Json {
+fn entry_to_json(entry: &TableEntry) -> Json {
match *entry {
- TableEntry::Bool(v) => Json::Boolean(v),
- TableEntry::ShortShortInt(v) => Json::I64(v as i64),
- TableEntry::ShortShortUint(v) => Json::U64(v as u64),
- TableEntry::ShortInt(v) => Json::I64(v as i64),
- TableEntry::ShortUint(v) => Json::U64(v as u64),
- TableEntry::LongInt(v) => Json::I64(v as i64),
- TableEntry::LongUint(v) => Json::U64(v as u64),
- TableEntry::LongLongInt(v) => Json::I64(v),
- TableEntry::LongLongUint(v) => Json::U64(v),
- TableEntry::Float(v) => Json::F64(v as f64),
- TableEntry::Double(v) => Json::F64(v),
- TableEntry::LongString(ref v) => Json::String(v.clone()),
- TableEntry::Void => Json::Null,
- TableEntry::FieldTable(ref v) => Json::Object(table_to_json(&v)),
- TableEntry::Timestamp(v) => Json::U64(v as u64), // maybe string date?
+ TableEntry::Bool(v) => Json::Boolean(v),
+ TableEntry::ShortShortInt(v) => Json::I64(v as i64),
+ TableEntry::ShortShortUint(v) => Json::U64(v as u64),
+ TableEntry::ShortInt(v) => Json::I64(v as i64),
+ TableEntry::ShortUint(v) => Json::U64(v as u64),
+ TableEntry::LongInt(v) => Json::I64(v as i64),
+ TableEntry::LongUint(v) => Json::U64(v as u64),
+ TableEntry::LongLongInt(v) => Json::I64(v),
+ TableEntry::LongLongUint(v) => Json::U64(v),
+ TableEntry::Float(v) => Json::F64(v as f64),
+ TableEntry::Double(v) => Json::F64(v),
+ TableEntry::LongString(ref v) => Json::String(v.clone()),
+ TableEntry::Void => Json::Null,
+ TableEntry::FieldTable(ref v) => Json::Object(table_to_json(&v)),
+ TableEntry::Timestamp(v) => Json::U64(v as u64), // maybe string date?
TableEntry::FieldArray(ref vs) => {
- let mut ret:Vec<Json> = Vec::new();
- for v in vs { ret.push(entry_to_json(v)) }
+ let mut ret: Vec<Json> = Vec::new();
+ for v in vs {
+ ret.push(entry_to_json(v))
+ }
Json::Array(ret)
- },
+ }
TableEntry::DecimalValue(decimals, v) => {
- let ten:f64 = (10 as u64).pow(decimals as u32) as f64;
- let dec:f64 = (v as f64) / ten;
+ let ten: f64 = (10 as u64).pow(decimals as u32) as f64;
+ let dec: f64 = (v as f64) / ten;
Json::F64(dec)
- },
+ }
//_ => Err(format!("Cant translate {:?}", entry)),
// TableEntry::ShortString(ref v) => Ok(Json::String(v.clone())),
}

View file

@ -0,0 +1,137 @@
--- src/publish.rs.orig 2018-10-14 20:00:28 UTC
+++ src/publish.rs
@@ -1,41 +1,38 @@
-use std::io::{self, Write};
use amqp;
-use amqp::protocol::basic::{Deliver, BasicProperties};
+use amqp::protocol::basic::{BasicProperties, Deliver};
+use amqp::Channel;
use clap::ArgMatches;
-use std::fs;
-use std::path::Path;
-use mime;
use client;
use error::RbtError;
+use mime;
use output;
-use amqp::{Channel};
+use std::fs;
+use std::io::{self, Write};
use std::panic;
+use std::path::Path;
-
// helper function to turn a filename
// into a mime-type
-fn type_from_file(file:&String) -> Result<String,RbtError> {
+fn type_from_file(file: &String) -> Result<String, RbtError> {
let t = mime::Types::new().or(Err("Failed to read mime types"))?;
let path = Path::new(&file);
let mime = t.mime_for_path(&path);
Ok(mime.to_owned())
}
-
-pub fn do_publish(opts:amqp::Options, matches:&ArgMatches) -> Result<(),RbtError> {
-
+pub fn do_publish(opts: amqp::Options, matches: &ArgMatches) -> Result<(), RbtError> {
// either stdin or a file
let file = value_t!(matches, "file", String)?;
- let rpc = matches.is_present("rpc");
+ let rpc = matches.is_present("rpc");
let reader: Box<io::Read> = match file.as_ref() {
"-" => Box::new(io::stdin()),
- _ => Box::new(fs::File::open(&file)?),
+ _ => Box::new(fs::File::open(&file)?),
};
// either - or the name of the file
- let file_name:&str = match file.as_ref() {
+ let file_name: &str = match file.as_ref() {
"-" => "-",
- _ => {
+ _ => {
// XXX fix unwrapping
let ostr = Path::new(&file).file_name().unwrap();
ostr.to_str().unwrap()
@@ -48,51 +45,49 @@ pub fn do_publish(opts:amqp::Options, matches:&ArgMatc
let c = matches.value_of("content_type").unwrap_or("-").to_string();
match c.as_ref() {
"-" => type_from_file(&file)?,
- _ => c,
+ _ => c,
}
};
-
// the sendable wraps up the parsed parts
let sendable = client::Sendable {
- exchange: value_t!(matches, "exchange", String)?,
- routing_key: value_t!(matches, "routing_key", String)?,
+ exchange: value_t!(matches, "exchange", String)?,
+ routing_key: value_t!(matches, "routing_key", String)?,
content_type: content_type,
- headers: values_t!(matches, "header", String).unwrap_or(vec![]),
- file_name: file_name.to_owned(),
- reader: reader,
- priority: value_t!(matches, "priority", u8).unwrap_or(0),
- rpctimeout: value_t!(matches, "rpctimeout", u64).unwrap_or(0)
+ headers: values_t!(matches, "header", String).unwrap_or(vec![]),
+ file_name: file_name.to_owned(),
+ reader: reader,
+ priority: value_t!(matches, "priority", u8).unwrap_or(0),
+ rpctimeout: value_t!(matches, "rpctimeout", u64).unwrap_or(0),
};
// if we are doing an rpc with replyTo/correlationId, we set up a receiver
let rpc_receive = match rpc {
false => None,
- true => {
- let receive =
- move |channel: &mut Channel, deliver:Deliver, props:BasicProperties, body:Vec<u8>| ->
- Result<(),RbtError> {
- let msg = output::build_output(false, &deliver, &props, body)?;
+ true => {
+ let receive = move |channel: &mut Channel,
+ deliver: Deliver,
+ props: BasicProperties,
+ body: Vec<u8>|
+ -> Result<(), RbtError> {
+ let msg = output::build_output(false, &deliver, &props, body)?;
- // just write to stdout
- let stdout = io::stdout();
+ // just write to stdout
+ let stdout = io::stdout();
- // lock until end of scope
- let mut handle = stdout.lock();
+ // lock until end of scope
+ let mut handle = stdout.lock();
- handle.write(&msg)?;
- handle.write(b"\n")?;
- handle.flush()?;
-
- // closing the channel
- channel.close(200, "Bye")?;
- panic::set_hook(Box::new(|_| {
- }));
- // Until amqp library finds a way to exit consumer, terminate consumer_thread here.
- panic!();
-
-
- };
+ handle.write(&msg)?;
+ handle.write(b"\n")?;
+ handle.flush()?;
+
+ // closing the channel
+ channel.close(200, "Bye")?;
+ panic::set_hook(Box::new(|_| {}));
+ // Until amqp library finds a way to exit consumer, terminate consumer_thread here.
+ panic!();
+ };
let receiver = client::Receiver {
exchange: "".to_owned(),

View file

@ -0,0 +1,147 @@
--- src/subscribe.rs.orig 2018-10-14 20:00:28 UTC
+++ src/subscribe.rs
@@ -1,23 +1,21 @@
-use std::io::{self, Write};
-use rand::{thread_rng, Rng, distributions::Alphanumeric};
-use amqp::protocol::basic::{Deliver, BasicProperties};
-use amqp::{self, TableEntry, Channel};
+use amqp::protocol::basic::{BasicProperties, Deliver};
+use amqp::{self, Channel, TableEntry};
use clap::ArgMatches;
-use std::fs;
-use std::path::Path;
-use mime;
use client;
-use output;
use error::RbtError;
+use mime;
+use output;
+use rand::{distributions::Alphanumeric, thread_rng, Rng};
+use std::fs;
+use std::io::{self, Write};
use std::panic;
+use std::path::Path;
-
-pub fn do_subscribe(opts:amqp::Options, matches:&ArgMatches) -> Result<(),RbtError> {
-
+pub fn do_subscribe(opts: amqp::Options, matches: &ArgMatches) -> Result<(), RbtError> {
let output = value_t!(matches, "output", String)?;
- let queue : Option<String> = matches.value_of("queue").map(str::to_owned);
- let force_declare : bool = matches.is_present("declare");
- let info = matches.is_present("info");
+ let queue: Option<String> = matches.value_of("queue").map(str::to_owned);
+ let force_declare: bool = matches.is_present("declare");
+ let info = matches.is_present("info");
let single = matches.is_present("single");
// type lookup map
@@ -33,14 +31,15 @@ pub fn do_subscribe(opts:amqp::Options, matches:&ArgMa
}
}
- let receive = move |channel: &mut Channel, deliver:Deliver, props:BasicProperties, body:Vec<u8>| ->
- Result<(),RbtError> {
-
+ let receive = move |channel: &mut Channel,
+ deliver: Deliver,
+ props: BasicProperties,
+ body: Vec<u8>|
+ -> Result<(), RbtError> {
let msg = output::build_output(info, &deliver, &props, body)?;
match output.as_ref() {
"-" => {
-
// just write to stdout
let stdout = io::stdout();
@@ -50,10 +49,8 @@ pub fn do_subscribe(opts:amqp::Options, matches:&ArgMa
handle.write(&msg)?;
handle.write(b"\n")?;
handle.flush()?;
-
- },
- _ => {
-
+ }
+ _ => {
// extract file name from headers, or fall back on random
let file_name = file_name_of(&props, &types);
@@ -70,60 +67,60 @@ pub fn do_subscribe(opts:amqp::Options, matches:&ArgMa
let mut f = fs::File::create(path)?;
f.write_all(&msg)?;
-
}
-
}
// maybe end here?
if single {
// closing the channel
channel.close(200, "Bye")?;
- panic::set_hook(Box::new(|_| {
- }));
+ panic::set_hook(Box::new(|_| {}));
// Until amqp library finds a way to exit consumer, terminate consumer_thread here.
panic!();
}
Ok(())
-
};
let receiver = client::Receiver {
exchange: value_t!(matches, "exchange", String)?,
routing_key: matches.value_of("routing_key").map(str::to_owned),
- auto_ack: ! matches.is_present("noack"),
+ auto_ack: !matches.is_present("noack"),
callback: Box::new(receive),
};
client::open_receive(opts, queue, force_declare, receiver)
}
-fn file_name_of(props:&BasicProperties, types:&mime::Types) -> String {
+fn file_name_of(props: &BasicProperties, types: &mime::Types) -> String {
+ let content_type = props
+ .content_type
+ .clone()
+ .unwrap_or("application/octet-stream".to_owned());
- let content_type =
- props.content_type.clone().unwrap_or("application/octet-stream".to_owned());
-
// figure out a good extension for this content type
- let ext = types.get_extension(&content_type)
+ let ext = types
+ .get_extension(&content_type)
.and_then(|x| Some(x[0].clone()))
.or_else(|| Some("bin".to_owned()))
.unwrap();
// prefer a fileName from headers, but fall back on
// a random name.
- props.headers.clone()
+ props
+ .headers
+ .clone()
.and_then(|x| match x.get("fileName") {
Some(&TableEntry::LongString(ref f)) => Some((*f).clone()),
- _ => None
+ _ => None,
})
.or_else(|| Some(gen_rand_name(ext)))
.unwrap()
}
-fn gen_rand_name(ext:String) -> String {
+fn gen_rand_name(ext: String) -> String {
// generate 16 ascii chars
- let mut rand:String = thread_rng().sample_iter(&Alphanumeric).take(16).collect();
+ let mut rand: String = thread_rng().sample_iter(&Alphanumeric).take(16).collect();
rand.push_str(".");
rand.push_str(&ext);
rand

4
net/rabbiteer/pkg-descr Normal file
View file

@ -0,0 +1,4 @@
Command-line tool for publishing and subscribing to RabbitMQ, including
support for publish, subscribe, and RabbitMQ-style rpc calls.
WWW: https://github.com/algesten/rabbiteer