Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
use crate::domain::models::messages::{ContactConnections, ContactsNodes};
use crate::domain::ports::ContactsIngressQueue;
use rootcause::Report;
/// SQS-backed implementation of [`ContactsIngressQueue`].
#[derive(Clone)]
pub struct SqsContactsQueue {
client: aws_sdk_sqs::Client,
queue_url: String,
}
impl SqsContactsQueue {
/// Creates a new queue adapter pointing at the given SQS queue URL.
pub fn new(client: aws_sdk_sqs::Client, queue_url: String) -> Self {
Self { client, queue_url }
}
}
impl SqsContactsQueue {
async fn publish<T: serde::Serialize>(&self, message: &T) -> Result<(), Report> {
let body = serde_json::to_string(message)?;
self.client
.send_message()
.queue_url(&self.queue_url)
.message_body(body)
.send()
.await?;
Ok(())
}
}
impl ContactsIngressQueue for SqsContactsQueue {
#[tracing::instrument(skip(self, message), err)]
async fn publish_nodes(&self, message: ContactsNodes) -> Result<(), Report> {
self.publish(&message).await
}
#[tracing::instrument(skip(self, message), err)]
async fn publish_connections(&self, message: ContactConnections) -> Result<(), Report> {
self.publish(&message).await
}
}