pub struct EventHubMessage(/* private fields */);
Expand description
Represents an Event Hubs message output binding.
The following binding attributes are supported:
Name | Description |
---|---|
name | The name of the parameter being bound. |
event_hub_name | The name of the event hub. When the event hub name is also present in the connection string, that value overrides this property at runtime. |
connection | The name of an app setting that contains the connection string to the event hub’s namespace. This connection string must have send permissions to send the message to the event stream. |
§Examples
Creating a message from a string:
use azure_functions::bindings::{HttpRequest, EventHubMessage};
use azure_functions::func;
#[func]
#[binding(name = "output1", connection = "connection", event_hub_name = "example")]
pub fn create_message(_req: HttpRequest) -> ((), EventHubMessage) {
((), "Hello world!".into())
}
Creating a message from a JSON value (see the json! macro from the serde_json
crate):
use azure_functions::bindings::{HttpRequest, EventHubMessage};
use azure_functions::func;
use serde_json::json;
#[func]
#[binding(name = "output1", connection = "connection", event_hub_name = "example")]
pub fn create_message(_req: HttpRequest) -> ((), EventHubMessage) {
(() ,json!({ "hello": "world!" }).into())
}
Creating a message from a sequence of bytes:
use azure_functions::bindings::{HttpRequest, EventHubMessage};
use azure_functions::func;
#[func]
#[binding(name = "output1", connection = "connection", event_hub_name = "example")]
pub fn create_message(_req: HttpRequest) -> ((), EventHubMessage) {
((), [1, 2, 3][..].into())
}
Implementations§
Source§impl EventHubMessage
impl EventHubMessage
Trait Implementations§
Source§impl Clone for EventHubMessage
impl Clone for EventHubMessage
Source§fn clone(&self) -> EventHubMessage
fn clone(&self) -> EventHubMessage
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 EventHubMessage
impl Debug for EventHubMessage
Source§impl Display for EventHubMessage
impl Display for EventHubMessage
Source§impl<'a> From<&'a [u8]> for EventHubMessage
impl<'a> From<&'a [u8]> for EventHubMessage
Source§impl From<&Value> for EventHubMessage
impl From<&Value> for EventHubMessage
Source§impl<'a> From<&'a str> for EventHubMessage
impl<'a> From<&'a str> for EventHubMessage
Source§impl From<String> for EventHubMessage
impl From<String> for EventHubMessage
Source§impl From<Value> for EventHubMessage
impl From<Value> for EventHubMessage
Source§impl<'a> Into<Body<'a>> for EventHubMessage
impl<'a> Into<Body<'a>> for EventHubMessage
Source§impl Into<String> for EventHubMessage
impl Into<String> for EventHubMessage
Source§impl Into<Value> for EventHubMessage
impl Into<Value> for EventHubMessage
Auto Trait Implementations§
impl Freeze for EventHubMessage
impl RefUnwindSafe for EventHubMessage
impl Send for EventHubMessage
impl Sync for EventHubMessage
impl Unpin for EventHubMessage
impl UnwindSafe for EventHubMessage
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