[−][src]Struct azure_functions::bindings::ServiceBusMessage
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() }
Methods
impl ServiceBusMessage
[src]
pub fn as_str(&self) -> Option<&str>
[src]
Gets the content of the message as a string.
Returns None if there is no valid string representation of the message.
pub fn as_bytes(&self) -> &[u8]
[src]
Gets the content of the message as a slice of bytes.
pub fn as_json<'b, T>(&'b self) -> Result<T> where
T: Deserialize<'b>,
[src]
T: Deserialize<'b>,
Deserializes the message as JSON to the requested type.
Trait Implementations
impl Into<String> for ServiceBusMessage
[src]
impl Into<Value> for ServiceBusMessage
[src]
impl Into<Vec<u8>> for ServiceBusMessage
[src]
impl<'a> Into<Body<'a>> for ServiceBusMessage
[src]
impl<'a> From<&'a str> for ServiceBusMessage
[src]
impl From<String> for ServiceBusMessage
[src]
impl<'_> From<&'_ Value> for ServiceBusMessage
[src]
impl From<Value> for ServiceBusMessage
[src]
impl<'a> From<&'a [u8]> for ServiceBusMessage
[src]
impl From<Vec<u8>> for ServiceBusMessage
[src]
impl Clone for ServiceBusMessage
[src]
fn clone(&self) -> ServiceBusMessage
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Display for ServiceBusMessage
[src]
impl Debug for ServiceBusMessage
[src]
Auto Trait Implementations
impl Send for ServiceBusMessage
impl Sync for ServiceBusMessage
impl Unpin for ServiceBusMessage
impl UnwindSafe for ServiceBusMessage
impl RefUnwindSafe for ServiceBusMessage
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> IntoRequest<T> for T
[src]
fn into_request(self) -> Request<T>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,