diff --git a/Cargo.lock b/Cargo.lock index 8f06411..be43081 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1851,8 +1851,8 @@ dependencies = [ ] [[package]] -name = "medullah_web" -version = "0.1.4" +name = "medullah-web" +version = "0.1.5" dependencies = [ "base64 0.22.0", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 32b7763..6fa021a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "medullah_web" -version = "0.1.4" +name = "medullah-web" +version = "0.1.5" edition = "2021" [features] diff --git a/src/app_setup.rs b/src/app_setup.rs index d3c3098..7d9d93d 100644 --- a/src/app_setup.rs +++ b/src/app_setup.rs @@ -23,6 +23,7 @@ use crate::MEDULLAH; #[cfg(feature = "feat-rabbitmq")] use crate::rabbitmq::conn::establish_rabbit_connection; use crate::redis::conn::{establish_redis_connection, establish_redis_connection_pool}; +use crate::services::rabbit_service::RabbitService; pub async fn make_app_state(env_prefix: String) -> MedullahState { let app = create_app_state(env_prefix).await; @@ -40,7 +41,7 @@ async fn create_app_state(env_prefix: String) -> MedullahState { // RabbitMQ #[cfg(feature = "feat-rabbitmq")] - let rabbit = establish_rabbit_connection(&env_prefix).await; + let rabbit = Arc::new(establish_rabbit_connection(&env_prefix).await); // templating let tpl_dir = get_cwd() + "/resources/templates/**/*.tera.html"; @@ -58,7 +59,7 @@ async fn create_app_state(env_prefix: String) -> MedullahState { redis: Arc::new(redis), redis_pool: Arc::new(redis_pool), #[cfg(feature = "feat-rabbitmq")] - rabbit: Arc::new(rabbit), + rabbit: rabbit.clone(), #[cfg(feature = "feat-database")] database: database_pool, tera: tera_templating, @@ -85,7 +86,7 @@ async fn create_app_state(env_prefix: String) -> MedullahState { services: AppServices { #[cfg(feature = "feat-rabbitmq")] - rabbitmq: rabbit.clone(), + rabbitmq: RabbitService::new(rabbit.clone()), redis: redis_service.clone(), cache: Arc::new(CacheService::new(redis_service)), }, diff --git a/src/app_state.rs b/src/app_state.rs index 287582a..b9c6db3 100644 --- a/src/app_state.rs +++ b/src/app_state.rs @@ -6,6 +6,7 @@ use tera::{Context, Tera}; use crate::redis::RedisPool; use crate::services::cache_service::CacheService; +use crate::services::rabbit_service::RabbitService; use crate::services::redis_service::RedisService; #[derive(Clone)] @@ -47,7 +48,7 @@ pub struct AppServices { pub redis: Arc, pub cache: Arc, #[cfg(feature = "feat-rabbitmq")] - pub rabbitmq: Arc, + pub rabbitmq: Arc, } impl MedullahState {