remove amqp return types
This commit is contained in:
parent
a34a4accaf
commit
98723462a0
|
@ -42,32 +42,34 @@ fn main() {
|
|||
})
|
||||
.unwrap();
|
||||
|
||||
let queue_name: String = if cfg.runner.build_all_jobs != Some(true) {
|
||||
let queue_name = if cfg.runner.build_all_jobs != Some(true) {
|
||||
let queue_name = format!("build-inputs-{}", cfg.nix.system.clone());
|
||||
channel
|
||||
.declare_queue(easyamqp::QueueConfig {
|
||||
queue: format!("build-inputs-{}", cfg.nix.system.clone()),
|
||||
queue: queue_name.clone(),
|
||||
passive: false,
|
||||
durable: true,
|
||||
exclusive: false,
|
||||
auto_delete: false,
|
||||
no_wait: false,
|
||||
})
|
||||
.unwrap()
|
||||
.queue
|
||||
.unwrap();
|
||||
queue_name
|
||||
} else {
|
||||
warn!("Building all jobs, please don't use this unless you're");
|
||||
warn!("developing and have Graham's permission!");
|
||||
let queue_name = "".to_owned();
|
||||
channel
|
||||
.declare_queue(easyamqp::QueueConfig {
|
||||
queue: "".to_owned(),
|
||||
queue: queue_name.clone(),
|
||||
passive: false,
|
||||
durable: false,
|
||||
exclusive: true,
|
||||
auto_delete: true,
|
||||
no_wait: false,
|
||||
})
|
||||
.unwrap()
|
||||
.queue
|
||||
.unwrap();
|
||||
queue_name
|
||||
};
|
||||
|
||||
channel
|
||||
|
|
|
@ -28,17 +28,17 @@ fn main() {
|
|||
})
|
||||
.unwrap();
|
||||
|
||||
let queue_name = channel
|
||||
let queue_name = "".to_owned();
|
||||
channel
|
||||
.declare_queue(easyamqp::QueueConfig {
|
||||
queue: "".to_owned(),
|
||||
queue: queue_name.clone(),
|
||||
passive: false,
|
||||
durable: false,
|
||||
exclusive: true,
|
||||
auto_delete: true,
|
||||
no_wait: false,
|
||||
})
|
||||
.unwrap()
|
||||
.queue;
|
||||
.unwrap();
|
||||
|
||||
channel
|
||||
.bind_queue(easyamqp::BindQueueConfig {
|
||||
|
|
|
@ -299,30 +299,30 @@ pub fn session_from_config(config: &RabbitMQConfig) -> Result<amqp::Session, amq
|
|||
pub trait TypedWrappers {
|
||||
type Error;
|
||||
|
||||
fn consume<T>(&mut self, callback: T, config: ConsumeConfig) -> Result<String, Self::Error>
|
||||
fn consume<T>(&mut self, callback: T, config: ConsumeConfig) -> Result<(), Self::Error>
|
||||
where
|
||||
T: amqp::Consumer + 'static;
|
||||
|
||||
fn declare_exchange(
|
||||
&mut self,
|
||||
config: ExchangeConfig,
|
||||
) -> Result<amqp::protocol::exchange::DeclareOk, Self::Error>;
|
||||
) -> Result<(), Self::Error>;
|
||||
|
||||
fn declare_queue(
|
||||
&mut self,
|
||||
config: QueueConfig,
|
||||
) -> Result<amqp::protocol::queue::DeclareOk, Self::Error>;
|
||||
) -> Result<(), Self::Error>;
|
||||
|
||||
fn bind_queue(
|
||||
&mut self,
|
||||
config: BindQueueConfig,
|
||||
) -> Result<amqp::protocol::queue::BindOk, Self::Error>;
|
||||
) -> Result<(), Self::Error>;
|
||||
}
|
||||
|
||||
impl TypedWrappers for amqp::Channel {
|
||||
type Error = amqp::AMQPError;
|
||||
|
||||
fn consume<T>(&mut self, callback: T, config: ConsumeConfig) -> Result<String, Self::Error>
|
||||
fn consume<T>(&mut self, callback: T, config: ConsumeConfig) -> Result<(), Self::Error>
|
||||
where
|
||||
T: amqp::Consumer + 'static,
|
||||
{
|
||||
|
@ -335,13 +335,14 @@ impl TypedWrappers for amqp::Channel {
|
|||
config.exclusive,
|
||||
config.no_wait,
|
||||
amqp::Table::new(),
|
||||
)
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn declare_exchange(
|
||||
&mut self,
|
||||
config: ExchangeConfig,
|
||||
) -> Result<amqp::protocol::exchange::DeclareOk, Self::Error> {
|
||||
) -> Result<(), Self::Error> {
|
||||
self.exchange_declare(
|
||||
config.exchange,
|
||||
config.exchange_type.into(),
|
||||
|
@ -351,13 +352,14 @@ impl TypedWrappers for amqp::Channel {
|
|||
config.internal,
|
||||
config.no_wait,
|
||||
amqp::Table::new(),
|
||||
)
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn declare_queue(
|
||||
&mut self,
|
||||
config: QueueConfig,
|
||||
) -> Result<amqp::protocol::queue::DeclareOk, Self::Error> {
|
||||
) -> Result<(), Self::Error> {
|
||||
self.queue_declare(
|
||||
config.queue,
|
||||
config.passive,
|
||||
|
@ -366,19 +368,21 @@ impl TypedWrappers for amqp::Channel {
|
|||
config.auto_delete,
|
||||
config.no_wait,
|
||||
amqp::Table::new(),
|
||||
)
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn bind_queue(
|
||||
&mut self,
|
||||
config: BindQueueConfig,
|
||||
) -> Result<amqp::protocol::queue::BindOk, Self::Error> {
|
||||
) -> Result<(), Self::Error> {
|
||||
self.queue_bind(
|
||||
config.queue,
|
||||
config.exchange,
|
||||
config.routing_key.unwrap_or_else(|| "".to_owned()),
|
||||
config.no_wait,
|
||||
amqp::Table::new(),
|
||||
)
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue