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

fix message queue send #749

Merged
merged 1 commit into from
Mar 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/agent/storage-queue/src/azure_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ pub struct AzureQueueMessage {
pub messages_url: Option<Url>,
}

#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
#[serde(rename = "QueueMessage")]
pub struct AzureQueueMessageSend {
pub message_text: String,
}

impl AzureQueueMessage {
pub fn parse<T>(&self, parser: impl FnOnce(&[u8]) -> Result<T>) -> Result<T> {
let decoded = base64::decode(&self.message_text)?;
Expand Down Expand Up @@ -122,7 +129,9 @@ impl AzureQueueClient {

pub async fn enqueue(&self, data: impl Serialize) -> Result<()> {
let serialized = serde_json::to_string(&data).unwrap();
let body = serde_xml_rs::to_string(&base64::encode(&serialized)).unwrap();
let body = serde_xml_rs::to_string(&AzureQueueMessageSend {
message_text: base64::encode(&serialized),
})?;
let r = self
.http
.post(self.messages_url.clone())
Expand Down