Skip to main content

EndpointHandle

Struct EndpointHandle 

Source
pub struct EndpointHandle {
    pub force_json: bool,
    /* private fields */
}
Expand description

The endpoint handle implements the EDA API

Fields§

§force_json: bool

Implementations§

Source§

impl EndpointHandle

Source

pub fn publish_event( &self, event: &str, message: &impl Serialize, conversation_id: &str, mandatory: bool, ) -> Result<(), Error>

Send a new Event on the EDA bus.

  • event is the name (class name) of the event;
  • message is the event payload;
  • conversation_id is the mandatory conversation ID;
  • if mandatory is true, a ClientMessage::MessageReturned(_) will be sent if the event is unroutable, that is, the exchange did not find any queue to put it in.
Source

pub fn publish_configuration( &self, event: &str, message: &impl Serialize, conversation_id: &str, ) -> Result<(), Error>

Send a new Configuration or Configuration Request on the EDA bus.

  • event is the name (class name) of the message;
  • message is the message payload;
  • conversation_id is the mandatory conversation ID;
Source

pub fn send_command( &self, command: &str, message: &impl Serialize, conversation_id: &str, reply_to: &str, correlation_id: &str, mandatory: bool, ) -> Result<(), Error>

Send a new Command on the EDA bus.

  • command is the name (class name) of the command;
  • message is the command payload;
  • conversation_id is the mandatory conversation ID;
  • reply_to: is the routing key to send the result to;
  • correlation_id: is the mandatory correlation ID used to reconcile the result with the command;
  • if mandatory is true, a ClientMessage::MessageReturned(_) will be sent if the command is unroutable, that is, the exchange did not find any queue to put it in.
Source

pub fn return_success( &self, destination: &str, message: &impl Serialize, conversation_id: &str, correlation_id: &str, mandatory: bool, ) -> Result<(), Error>

Send a new successful Result on the EDA bus.

  • destination is routing key to which the result is to be sent;
  • message is the result payload;
  • conversation_id is the mandatory conversation ID;
  • correlation_id: is the mandatory correlation ID used to reconcile the result with the command;
  • if mandatory is true, a ClientMessage::MessageReturned(_) will be sent if the result is unroutable, that is, the exchange did not find any queue to put it in.
Source

pub fn return_error( &self, destination: &str, message: &impl Serialize, conversation_id: &str, correlation_id: &str, mandatory: bool, ) -> Result<(), Error>

Send a new failure Result on the EDA bus.

  • destination is routing key to which the result is to be sent;
  • message is the result payload;
  • conversation_id is the mandatory conversation ID;
  • correlation_id: is the mandatory correlation ID used to reconcile the result with the command;
  • if mandatory is true, a ClientMessage::MessageReturned(_) will be sent if the result is unroutable, that is, the exchange did not find any queue to put it in.
Source

pub fn log_with_extra_fields( &self, criticity: Criticity, short_message: &str, full_message: &str, conversation_id: &str, extra_fields: ExtraFields, ) -> Result<(), Error>

Log on the EDA log bus with custom fields.

Source

pub fn log( &self, criticity: Criticity, short_message: &str, full_message: &str, conversation_id: &str, ) -> Result<(), Error>

Log on the EDA log bus

Source

pub fn configured(&self) -> Result<(), Error>

Tell the endpoint that the client is configured and ready to accept events and commands.

You don’t need to call this method explicitly if you use the Callback API.

Source

pub fn ack_delivery(&self, delivery_tag: u64) -> Result<(), Error>

Tell the broker to immediately remove the message from the queue.

Use this method only if there is no pending publishes triggered by this message. If unsure, use Self::delivery_processed() instead.

Source

pub fn delivery_processed(&self, delivery_tag: u64) -> Result<(), Error>

Tell the endpoint that the message was successfully processed and can be safely removed from the queue when all current publishing is actually done.

You don’t need to call this method explicitly if you use the Callback API.

Source

pub fn nack_delivery(&self, delivery_tag: u64) -> Result<(), Error>

Tell the broker that the message was not properly handled (transient error) and should be requeued to be retried later.

You don’t need to call this method explicitly if you use the Callback API.

Source

pub fn reject_delivery(&self, delivery_tag: u64) -> Result<(), Error>

Tell the broker that the message in unprocessable and must be rejected (to dead-letter).

You don’t need to call this method explicitly if you use the Callback API.

Trait Implementations§

Source§

impl Clone for EndpointHandle

Source§

fn clone(&self) -> EndpointHandle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.