pub struct ServiceBusMessage(/* private fields */);
Expand description
Represents a Service Bus message output binding.
The following binding attributes are supported:
Name | Description |
---|---|
name | The name of the parameter being bound. |
queue_name | The name of the queue. Use only if sending queue messages, not for a topic. |
topic_name | The name of the topic. Use only if sending topic messages, not for a queue. |
subscription_name | The name of the subscription. Use only if sending topic messages, not for a queue. |
connection | The name of an app setting that contains the Service Bus connection string to use for this binding. Defaults to AzureWebJobsServiceBus . |
§Examples
An example that creates a Service Bus queue message based on a HTTP trigger:
use azure_functions::{
bindings::{HttpRequest, ServiceBusMessage},
func,
};
#[func]
#[binding(name = "$return", queue_name = "example", connection = "connection")]
pub fn create_queue_message(req: HttpRequest) -> ServiceBusMessage {
format!(
"Hello from Rust, {}!\n",
req.query_params().get("name").map_or("stranger", |x| x)
)
.into()
}
An example that creates a Service Bus topic message based on a HTTP trigger:
use azure_functions::{
bindings::{HttpRequest, ServiceBusMessage},
func,
};
#[func]
#[binding(
name = "$return",
topic_name = "mytopic",
subscription_name = "mysubscription",
connection = "connection"
)]
pub fn create_topic_message(req: HttpRequest) -> ServiceBusMessage {
format!(
"Hello from Rust, {}!\n",
req.query_params().get("name").map_or("stranger", |x| x)
)
.into()
}
Implementations§
Source§impl ServiceBusMessage
impl ServiceBusMessage
Trait Implementations§
Source§impl Clone for ServiceBusMessage
impl Clone for ServiceBusMessage
Source§fn clone(&self) -> ServiceBusMessage
fn clone(&self) -> ServiceBusMessage
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ServiceBusMessage
impl Debug for ServiceBusMessage
Source§impl Display for ServiceBusMessage
impl Display for ServiceBusMessage
Source§impl<'a> From<&'a [u8]> for ServiceBusMessage
impl<'a> From<&'a [u8]> for ServiceBusMessage
Source§impl From<&Value> for ServiceBusMessage
impl From<&Value> for ServiceBusMessage
Source§impl<'a> From<&'a str> for ServiceBusMessage
impl<'a> From<&'a str> for ServiceBusMessage
Source§impl From<String> for ServiceBusMessage
impl From<String> for ServiceBusMessage
Source§impl From<Value> for ServiceBusMessage
impl From<Value> for ServiceBusMessage
Source§impl<'a> Into<Body<'a>> for ServiceBusMessage
impl<'a> Into<Body<'a>> for ServiceBusMessage
Source§impl Into<String> for ServiceBusMessage
impl Into<String> for ServiceBusMessage
Source§impl Into<Value> for ServiceBusMessage
impl Into<Value> for ServiceBusMessage
Auto Trait Implementations§
impl Freeze for ServiceBusMessage
impl RefUnwindSafe for ServiceBusMessage
impl Send for ServiceBusMessage
impl Sync for ServiceBusMessage
impl Unpin for ServiceBusMessage
impl UnwindSafe for ServiceBusMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request