Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
Merge branch '0.1.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
amigin committed Sep 4, 2022
2 parents 789a9a3 + 15de781 commit e5e1d1b
Show file tree
Hide file tree
Showing 32 changed files with 590 additions and 1,198 deletions.
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[package]
name = "my-service-bus-tcp-client"
version = "0.1.0"
version = "0.1.6"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
my-service-bus-shared = { branch = "main", git = "https://github.com/MyJetTools/my-service-bus-shared.git" }
my-service-bus-tcp-shared = { branch = "main", git = "https://github.com/MyJetTools/my-service-bus-tcp-shared.git" }
rust-extensions = { branch = "main", git = "https://github.com/MyJetTools/rust-extensions.git" }
my-service-bus-shared = { tag = "0.2.4", git = "https://github.com/MyJetTools/my-service-bus-shared.git" }
my-service-bus-tcp-shared = { tag = "0.2.6", git = "https://github.com/MyJetTools/my-service-bus-tcp-shared.git" }
my-tcp-sockets = { tag = "0.1.6", git = "https://github.com/MyJetTools/my-tcp-sockets.git" }
rust-extensions = { tag = "0.1.2", git = "https://github.com/MyJetTools/rust-extensions.git" }

tokio = { version = "*", features = ["full"] }
tokio-util = "*"
Expand Down
47 changes: 0 additions & 47 deletions src/date_utils.rs

This file was deleted.

8 changes: 2 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
mod date_utils;
mod logger;
mod my_sb_client;
mod publishers;
pub mod subscribers;
mod tcp;

pub use logger::MySbLogger;
pub use my_sb_client::MyServiceBusClient;
pub use publishers::{MySbPublisherData, MySbPublishers};
pub use publishers::{MySbPublisherData, MySbPublishers, PublishError};
pub use tcp::{MessageToPublish, MyServiceBusClient};
13 changes: 0 additions & 13 deletions src/logger/log_event.rs

This file was deleted.

50 changes: 0 additions & 50 deletions src/logger/logger.rs

This file was deleted.

27 changes: 0 additions & 27 deletions src/logger/logger_reader.rs

This file was deleted.

9 changes: 0 additions & 9 deletions src/logger/mod.rs

This file was deleted.

110 changes: 0 additions & 110 deletions src/my_sb_client.rs

This file was deleted.

23 changes: 15 additions & 8 deletions src/publishers/my_sb_publisher.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use std::sync::Arc;

use my_service_bus_tcp_shared::{MySbTcpSerializer, TcpContract};
use my_tcp_sockets::{tcp_connection::SocketConnection, ConnectionId};
use tokio::sync::Mutex;

use crate::tcp::MessageToPublish;

use super::{MySbPublisherData, PublishError, PublishProcessByConnection};
use crate::tcp::SocketConnection;
use rust_extensions::TaskCompletionAwaiter;

pub struct MySbPublishers {
Expand All @@ -17,12 +20,16 @@ impl MySbPublishers {
data: Mutex::new(data),
}
}
pub async fn publish(&self, topic_id: &str, payload: Vec<u8>) -> Result<(), PublishError> {
pub async fn publish(
&self,
topic_id: &str,
message: MessageToPublish,
) -> Result<(), PublishError> {
let awaiter: TaskCompletionAwaiter<(), PublishError>;
{
let mut write_access = self.data.lock().await;
awaiter = write_access
.publish_to_socket(topic_id, vec![payload])
.publish_to_socket(topic_id, vec![message])
.await?;
}
awaiter.get_result().await?;
Expand All @@ -33,24 +40,24 @@ impl MySbPublishers {
pub async fn publish_chunk(
&self,
topic_id: &str,
payload: Vec<Vec<u8>>,
messages: Vec<MessageToPublish>,
) -> Result<(), PublishError> {
let awaiter: TaskCompletionAwaiter<(), PublishError>;
{
let mut write_access = self.data.lock().await;
awaiter = write_access.publish_to_socket(topic_id, payload).await?;
awaiter = write_access.publish_to_socket(topic_id, messages).await?;
}
awaiter.get_result().await?;

return Ok(());
}

pub async fn publish_confirmed(&self, connection_id: i64, request_id: i64) {
pub async fn publish_confirmed(&self, connection_id: ConnectionId, request_id: i64) {
let mut write_access = self.data.lock().await;
write_access.confirm(connection_id, request_id).await;
}

pub async fn new_connection(&self, ctx: Arc<SocketConnection>) {
pub async fn new_connection(&self, ctx: Arc<SocketConnection<TcpContract, MySbTcpSerializer>>) {
let mut write_access = self.data.lock().await;

if let Some(current_connection) = &write_access.connection {
Expand All @@ -61,7 +68,7 @@ impl MySbPublishers {
write_access.connection = Some(PublishProcessByConnection::new(ctx));
}

pub async fn disconnect(&self, connection_id: i64) {
pub async fn disconnect(&self, connection_id: ConnectionId) {
let mut write_access = self.data.lock().await;

if let Some(current_connection) = &write_access.connection {
Expand Down
Loading

0 comments on commit e5e1d1b

Please sign in to comment.