[−][src]Struct hedwig::Hedwig
Central instance to access all Hedwig related resources
Methods
impl<T, P> Hedwig<T, P> where
P: Publisher,
[src]
P: Publisher,
pub fn new(
schema: &str,
publisher_name: &str,
publisher: P,
message_router: MessageRouter<T>
) -> Result<Hedwig<T, P>, HedwigError>
[src]
schema: &str,
publisher_name: &str,
publisher: P,
message_router: MessageRouter<T>
) -> Result<Hedwig<T, P>, HedwigError>
Creates a new Hedwig instance. Application credentials cannot be auto-discovered in Google Cloud environment unlike the Python library.
Arguments
- schema: The JSON schema content. It's up to the caller to read the schema from a file.
- publisher name: Name of the publisher service. This will be part of the metadata in the message.
- publisher - An implementation of Publisher
- message_router - A function that can route messages to topics
pub fn message<D>(
&self,
data_type: T,
data_schema_version: Version,
data: D
) -> Result<Message<D, T>, MessageError> where
D: Serialize,
T: Copy + Into<&'static str>,
[src]
&self,
data_type: T,
data_schema_version: Version,
data: D
) -> Result<Message<D, T>, MessageError> where
D: Serialize,
T: Copy + Into<&'static str>,
Creates a new message with given data type, schema version and data object.
Arguments
- data_type - An Enum instance with static str representation
- data_schema_version - Version of the data object
- data - The message data - must be serializable
pub fn publish<D>(&self, message: Message<D, T>) -> Result<String, PublishError> where
D: Serialize,
[src]
D: Serialize,
Publish a message using the configured publisher. Returns the publish id if successful. The publish id depends on your publisher.
Arguments
message
- the message to publish
Auto Trait Implementations
impl<T, P> !Send for Hedwig<T, P>
impl<T, P> Unpin for Hedwig<T, P> where
P: Unpin,
P: Unpin,
impl<T, P> !Sync for Hedwig<T, P>
impl<T, P> !UnwindSafe for Hedwig<T, P>
impl<T, P> !RefUnwindSafe for Hedwig<T, P>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> GetTypeId for T where
T: Any,
[src]
T: Any,