#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PingResult {
#[prost(string, tag = "1")]
pub host: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub server_start_time: i64,
#[prost(int64, tag = "4")]
pub server_up_time_seconds: i64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Empty {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Result {
#[prost(string, tag = "1")]
pub event_id: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub sent: bool,
#[prost(string, tag = "3")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Event {
#[prost(string, tag = "1")]
pub event_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub channel: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub metadata: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "5")]
pub body: ::prost::alloc::vec::Vec<u8>,
#[prost(bool, tag = "6")]
pub store: bool,
#[prost(map = "string, string", tag = "7")]
pub tags: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EventReceive {
#[prost(string, tag = "1")]
pub event_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub channel: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub metadata: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "4")]
pub body: ::prost::alloc::vec::Vec<u8>,
#[prost(int64, tag = "5")]
pub timestamp: i64,
#[prost(uint64, tag = "6")]
pub sequence: u64,
#[prost(map = "string, string", tag = "7")]
pub tags: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Subscribe {
#[prost(enumeration = "subscribe::SubscribeType", tag = "1")]
pub subscribe_type_data: i32,
#[prost(string, tag = "2")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub channel: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub group: ::prost::alloc::string::String,
#[prost(enumeration = "subscribe::EventsStoreType", tag = "5")]
pub events_store_type_data: i32,
#[prost(int64, tag = "6")]
pub events_store_type_value: i64,
}
pub mod subscribe {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum SubscribeType {
Undefined = 0,
Events = 1,
EventsStore = 2,
Commands = 3,
Queries = 4,
}
impl SubscribeType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Undefined => "SubscribeTypeUndefined",
Self::Events => "Events",
Self::EventsStore => "EventsStore",
Self::Commands => "Commands",
Self::Queries => "Queries",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SubscribeTypeUndefined" => Some(Self::Undefined),
"Events" => Some(Self::Events),
"EventsStore" => Some(Self::EventsStore),
"Commands" => Some(Self::Commands),
"Queries" => Some(Self::Queries),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum EventsStoreType {
Undefined = 0,
StartNewOnly = 1,
StartFromFirst = 2,
StartFromLast = 3,
StartAtSequence = 4,
StartAtTime = 5,
StartAtTimeDelta = 6,
}
impl EventsStoreType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Undefined => "EventsStoreTypeUndefined",
Self::StartNewOnly => "StartNewOnly",
Self::StartFromFirst => "StartFromFirst",
Self::StartFromLast => "StartFromLast",
Self::StartAtSequence => "StartAtSequence",
Self::StartAtTime => "StartAtTime",
Self::StartAtTimeDelta => "StartAtTimeDelta",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"EventsStoreTypeUndefined" => Some(Self::Undefined),
"StartNewOnly" => Some(Self::StartNewOnly),
"StartFromFirst" => Some(Self::StartFromFirst),
"StartFromLast" => Some(Self::StartFromLast),
"StartAtSequence" => Some(Self::StartAtSequence),
"StartAtTime" => Some(Self::StartAtTime),
"StartAtTimeDelta" => Some(Self::StartAtTimeDelta),
_ => None,
}
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Request {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(enumeration = "request::RequestType", tag = "2")]
pub request_type_data: i32,
#[prost(string, tag = "3")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub channel: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub metadata: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "6")]
pub body: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "7")]
pub reply_channel: ::prost::alloc::string::String,
#[prost(int32, tag = "8")]
pub timeout: i32,
#[prost(string, tag = "9")]
pub cache_key: ::prost::alloc::string::String,
#[prost(int32, tag = "10")]
pub cache_ttl: i32,
#[prost(bytes = "vec", tag = "11")]
pub span: ::prost::alloc::vec::Vec<u8>,
#[prost(map = "string, string", tag = "12")]
pub tags: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
pub mod request {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum RequestType {
Unknown = 0,
Command = 1,
Query = 2,
}
impl RequestType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "RequestTypeUnknown",
Self::Command => "Command",
Self::Query => "Query",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"RequestTypeUnknown" => Some(Self::Unknown),
"Command" => Some(Self::Command),
"Query" => Some(Self::Query),
_ => None,
}
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Response {
#[prost(string, tag = "1")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub request_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub reply_channel: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub metadata: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "5")]
pub body: ::prost::alloc::vec::Vec<u8>,
#[prost(bool, tag = "6")]
pub cache_hit: bool,
#[prost(int64, tag = "7")]
pub timestamp: i64,
#[prost(bool, tag = "8")]
pub executed: bool,
#[prost(string, tag = "9")]
pub error: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "10")]
pub span: ::prost::alloc::vec::Vec<u8>,
#[prost(map = "string, string", tag = "11")]
pub tags: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueueMessage {
#[prost(string, tag = "1")]
pub message_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub channel: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub metadata: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "5")]
pub body: ::prost::alloc::vec::Vec<u8>,
#[prost(map = "string, string", tag = "6")]
pub tags: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(message, optional, tag = "7")]
pub attributes: ::core::option::Option<QueueMessageAttributes>,
#[prost(message, optional, tag = "8")]
pub policy: ::core::option::Option<QueueMessagePolicy>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueueMessagesBatchRequest {
#[prost(string, tag = "1")]
pub batch_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub messages: ::prost::alloc::vec::Vec<QueueMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueueMessagesBatchResponse {
#[prost(string, tag = "1")]
pub batch_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub results: ::prost::alloc::vec::Vec<SendQueueMessageResult>,
#[prost(bool, tag = "3")]
pub have_errors: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueueMessageAttributes {
#[prost(int64, tag = "1")]
pub timestamp: i64,
#[prost(uint64, tag = "2")]
pub sequence: u64,
#[prost(string, tag = "3")]
pub md5_of_body: ::prost::alloc::string::String,
#[prost(int32, tag = "4")]
pub receive_count: i32,
#[prost(bool, tag = "5")]
pub re_routed: bool,
#[prost(string, tag = "6")]
pub re_routed_from_queue: ::prost::alloc::string::String,
#[prost(int64, tag = "7")]
pub expiration_at: i64,
#[prost(int64, tag = "8")]
pub delayed_to: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueueMessagePolicy {
#[prost(int32, tag = "1")]
pub expiration_seconds: i32,
#[prost(int32, tag = "2")]
pub delay_seconds: i32,
#[prost(int32, tag = "3")]
pub max_receive_count: i32,
#[prost(string, tag = "4")]
pub max_receive_queue: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SendQueueMessageResult {
#[prost(string, tag = "1")]
pub message_id: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub sent_at: i64,
#[prost(int64, tag = "3")]
pub expiration_at: i64,
#[prost(int64, tag = "4")]
pub delayed_to: i64,
#[prost(bool, tag = "5")]
pub is_error: bool,
#[prost(string, tag = "6")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReceiveQueueMessagesRequest {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub channel: ::prost::alloc::string::String,
#[prost(int32, tag = "4")]
pub max_number_of_messages: i32,
#[prost(int32, tag = "5")]
pub wait_time_seconds: i32,
#[prost(bool, tag = "6")]
pub is_peak: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReceiveQueueMessagesResponse {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub messages: ::prost::alloc::vec::Vec<QueueMessage>,
#[prost(int32, tag = "3")]
pub messages_received: i32,
#[prost(int32, tag = "4")]
pub messages_expired: i32,
#[prost(bool, tag = "5")]
pub is_peak: bool,
#[prost(bool, tag = "6")]
pub is_error: bool,
#[prost(string, tag = "7")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AckAllQueueMessagesRequest {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub channel: ::prost::alloc::string::String,
#[prost(int32, tag = "4")]
pub wait_time_seconds: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AckAllQueueMessagesResponse {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub affected_messages: u64,
#[prost(bool, tag = "3")]
pub is_error: bool,
#[prost(string, tag = "4")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamQueueMessagesRequest {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub client_id: ::prost::alloc::string::String,
#[prost(enumeration = "StreamRequestType", tag = "3")]
pub stream_request_type_data: i32,
#[prost(string, tag = "4")]
pub channel: ::prost::alloc::string::String,
#[prost(int32, tag = "5")]
pub visibility_seconds: i32,
#[prost(int32, tag = "6")]
pub wait_time_seconds: i32,
#[prost(uint64, tag = "7")]
pub ref_sequence: u64,
#[prost(message, optional, tag = "8")]
pub modified_message: ::core::option::Option<QueueMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamQueueMessagesResponse {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(enumeration = "StreamRequestType", tag = "2")]
pub stream_request_type_data: i32,
#[prost(message, optional, tag = "3")]
pub message: ::core::option::Option<QueueMessage>,
#[prost(bool, tag = "4")]
pub is_error: bool,
#[prost(string, tag = "5")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueuesUpstreamRequest {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub messages: ::prost::alloc::vec::Vec<QueueMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueuesUpstreamResponse {
#[prost(string, tag = "1")]
pub ref_request_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub results: ::prost::alloc::vec::Vec<SendQueueMessageResult>,
#[prost(bool, tag = "3")]
pub is_error: bool,
#[prost(string, tag = "4")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueuesDownstreamRequest {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub client_id: ::prost::alloc::string::String,
#[prost(enumeration = "QueuesDownstreamRequestType", tag = "3")]
pub request_type_data: i32,
#[prost(string, tag = "4")]
pub channel: ::prost::alloc::string::String,
#[prost(int32, tag = "5")]
pub max_items: i32,
#[prost(int32, tag = "6")]
pub wait_timeout: i32,
#[prost(bool, tag = "7")]
pub auto_ack: bool,
#[prost(string, tag = "8")]
pub re_queue_channel: ::prost::alloc::string::String,
#[prost(int64, repeated, tag = "9")]
pub sequence_range: ::prost::alloc::vec::Vec<i64>,
#[prost(string, tag = "10")]
pub ref_transaction_id: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "12")]
pub metadata: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueuesDownstreamResponse {
#[prost(string, tag = "1")]
pub transaction_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub ref_request_id: ::prost::alloc::string::String,
#[prost(enumeration = "QueuesDownstreamRequestType", tag = "3")]
pub request_type_data: i32,
#[prost(message, repeated, tag = "4")]
pub messages: ::prost::alloc::vec::Vec<QueueMessage>,
#[prost(int64, repeated, tag = "5")]
pub active_offsets: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "6")]
pub is_error: bool,
#[prost(string, tag = "7")]
pub error: ::prost::alloc::string::String,
#[prost(bool, tag = "8")]
pub transaction_complete: bool,
#[prost(map = "string, string", tag = "9")]
pub metadata: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum StreamRequestType {
Unknown = 0,
ReceiveMessage = 1,
AckMessage = 2,
RejectMessage = 3,
ModifyVisibility = 4,
ResendMessage = 5,
SendModifiedMessage = 6,
}
impl StreamRequestType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "StreamRequestTypeUnknown",
Self::ReceiveMessage => "ReceiveMessage",
Self::AckMessage => "AckMessage",
Self::RejectMessage => "RejectMessage",
Self::ModifyVisibility => "ModifyVisibility",
Self::ResendMessage => "ResendMessage",
Self::SendModifiedMessage => "SendModifiedMessage",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"StreamRequestTypeUnknown" => Some(Self::Unknown),
"ReceiveMessage" => Some(Self::ReceiveMessage),
"AckMessage" => Some(Self::AckMessage),
"RejectMessage" => Some(Self::RejectMessage),
"ModifyVisibility" => Some(Self::ModifyVisibility),
"ResendMessage" => Some(Self::ResendMessage),
"SendModifiedMessage" => Some(Self::SendModifiedMessage),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum QueuesDownstreamRequestType {
PollRequestTypeUnknown = 0,
Get = 1,
AckAll = 2,
AckRange = 3,
NAckAll = 4,
NAckRange = 5,
ReQueueAll = 6,
ReQueueRange = 7,
ActiveOffsets = 8,
TransactionStatus = 9,
CloseByClient = 10,
CloseByServer = 11,
}
impl QueuesDownstreamRequestType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::PollRequestTypeUnknown => "PollRequestTypeUnknown",
Self::Get => "Get",
Self::AckAll => "AckAll",
Self::AckRange => "AckRange",
Self::NAckAll => "NAckAll",
Self::NAckRange => "NAckRange",
Self::ReQueueAll => "ReQueueAll",
Self::ReQueueRange => "ReQueueRange",
Self::ActiveOffsets => "ActiveOffsets",
Self::TransactionStatus => "TransactionStatus",
Self::CloseByClient => "CloseByClient",
Self::CloseByServer => "CloseByServer",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PollRequestTypeUnknown" => Some(Self::PollRequestTypeUnknown),
"Get" => Some(Self::Get),
"AckAll" => Some(Self::AckAll),
"AckRange" => Some(Self::AckRange),
"NAckAll" => Some(Self::NAckAll),
"NAckRange" => Some(Self::NAckRange),
"ReQueueAll" => Some(Self::ReQueueAll),
"ReQueueRange" => Some(Self::ReQueueRange),
"ActiveOffsets" => Some(Self::ActiveOffsets),
"TransactionStatus" => Some(Self::TransactionStatus),
"CloseByClient" => Some(Self::CloseByClient),
"CloseByServer" => Some(Self::CloseByServer),
_ => None,
}
}
}
pub mod kubemq_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct KubemqClient<T> {
inner: tonic::client::Grpc<T>,
}
impl KubemqClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> KubemqClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> KubemqClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
KubemqClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn send_event(
&mut self,
request: impl tonic::IntoRequest<super::Event>,
) -> std::result::Result<tonic::Response<super::Result>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/kubemq.kubemq/SendEvent");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("kubemq.kubemq", "SendEvent"));
self.inner.unary(req, path, codec).await
}
pub async fn send_events_stream(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::Event>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::Result>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/SendEventsStream",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "SendEventsStream"));
self.inner.streaming(req, path, codec).await
}
pub async fn subscribe_to_events(
&mut self,
request: impl tonic::IntoRequest<super::Subscribe>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::EventReceive>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/SubscribeToEvents",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "SubscribeToEvents"));
self.inner.server_streaming(req, path, codec).await
}
pub async fn subscribe_to_requests(
&mut self,
request: impl tonic::IntoRequest<super::Subscribe>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::Request>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/SubscribeToRequests",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "SubscribeToRequests"));
self.inner.server_streaming(req, path, codec).await
}
pub async fn send_request(
&mut self,
request: impl tonic::IntoRequest<super::Request>,
) -> std::result::Result<tonic::Response<super::Response>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/SendRequest",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("kubemq.kubemq", "SendRequest"));
self.inner.unary(req, path, codec).await
}
pub async fn send_response(
&mut self,
request: impl tonic::IntoRequest<super::Response>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/SendResponse",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "SendResponse"));
self.inner.unary(req, path, codec).await
}
pub async fn send_queue_message(
&mut self,
request: impl tonic::IntoRequest<super::QueueMessage>,
) -> std::result::Result<
tonic::Response<super::SendQueueMessageResult>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/SendQueueMessage",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "SendQueueMessage"));
self.inner.unary(req, path, codec).await
}
pub async fn send_queue_messages_batch(
&mut self,
request: impl tonic::IntoRequest<super::QueueMessagesBatchRequest>,
) -> std::result::Result<
tonic::Response<super::QueueMessagesBatchResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/SendQueueMessagesBatch",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "SendQueueMessagesBatch"));
self.inner.unary(req, path, codec).await
}
pub async fn receive_queue_messages(
&mut self,
request: impl tonic::IntoRequest<super::ReceiveQueueMessagesRequest>,
) -> std::result::Result<
tonic::Response<super::ReceiveQueueMessagesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/ReceiveQueueMessages",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "ReceiveQueueMessages"));
self.inner.unary(req, path, codec).await
}
pub async fn stream_queue_message(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::StreamQueueMessagesRequest,
>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::StreamQueueMessagesResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/StreamQueueMessage",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "StreamQueueMessage"));
self.inner.streaming(req, path, codec).await
}
pub async fn ack_all_queue_messages(
&mut self,
request: impl tonic::IntoRequest<super::AckAllQueueMessagesRequest>,
) -> std::result::Result<
tonic::Response<super::AckAllQueueMessagesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/AckAllQueueMessages",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "AckAllQueueMessages"));
self.inner.unary(req, path, codec).await
}
pub async fn ping(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> std::result::Result<tonic::Response<super::PingResult>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/kubemq.kubemq/Ping");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("kubemq.kubemq", "Ping"));
self.inner.unary(req, path, codec).await
}
pub async fn queues_downstream(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::QueuesDownstreamRequest,
>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::QueuesDownstreamResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/QueuesDownstream",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "QueuesDownstream"));
self.inner.streaming(req, path, codec).await
}
pub async fn queues_upstream(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::QueuesUpstreamRequest,
>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::QueuesUpstreamResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/kubemq.kubemq/QueuesUpstream",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(GrpcMethod::new("kubemq.kubemq", "QueuesUpstream"));
self.inner.streaming(req, path, codec).await
}
}
}
pub mod kubemq_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Kubemq: std::marker::Send + std::marker::Sync + 'static {
async fn send_event(
&self,
request: tonic::Request<super::Event>,
) -> std::result::Result<tonic::Response<super::Result>, tonic::Status>;
type SendEventsStreamStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::Result, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn send_events_stream(
&self,
request: tonic::Request<tonic::Streaming<super::Event>>,
) -> std::result::Result<
tonic::Response<Self::SendEventsStreamStream>,
tonic::Status,
>;
type SubscribeToEventsStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::EventReceive, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn subscribe_to_events(
&self,
request: tonic::Request<super::Subscribe>,
) -> std::result::Result<
tonic::Response<Self::SubscribeToEventsStream>,
tonic::Status,
>;
type SubscribeToRequestsStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::Request, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn subscribe_to_requests(
&self,
request: tonic::Request<super::Subscribe>,
) -> std::result::Result<
tonic::Response<Self::SubscribeToRequestsStream>,
tonic::Status,
>;
async fn send_request(
&self,
request: tonic::Request<super::Request>,
) -> std::result::Result<tonic::Response<super::Response>, tonic::Status>;
async fn send_response(
&self,
request: tonic::Request<super::Response>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
async fn send_queue_message(
&self,
request: tonic::Request<super::QueueMessage>,
) -> std::result::Result<
tonic::Response<super::SendQueueMessageResult>,
tonic::Status,
>;
async fn send_queue_messages_batch(
&self,
request: tonic::Request<super::QueueMessagesBatchRequest>,
) -> std::result::Result<
tonic::Response<super::QueueMessagesBatchResponse>,
tonic::Status,
>;
async fn receive_queue_messages(
&self,
request: tonic::Request<super::ReceiveQueueMessagesRequest>,
) -> std::result::Result<
tonic::Response<super::ReceiveQueueMessagesResponse>,
tonic::Status,
>;
type StreamQueueMessageStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<
super::StreamQueueMessagesResponse,
tonic::Status,
>,
>
+ std::marker::Send
+ 'static;
async fn stream_queue_message(
&self,
request: tonic::Request<tonic::Streaming<super::StreamQueueMessagesRequest>>,
) -> std::result::Result<
tonic::Response<Self::StreamQueueMessageStream>,
tonic::Status,
>;
async fn ack_all_queue_messages(
&self,
request: tonic::Request<super::AckAllQueueMessagesRequest>,
) -> std::result::Result<
tonic::Response<super::AckAllQueueMessagesResponse>,
tonic::Status,
>;
async fn ping(
&self,
request: tonic::Request<super::Empty>,
) -> std::result::Result<tonic::Response<super::PingResult>, tonic::Status>;
type QueuesDownstreamStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<
super::QueuesDownstreamResponse,
tonic::Status,
>,
>
+ std::marker::Send
+ 'static;
async fn queues_downstream(
&self,
request: tonic::Request<tonic::Streaming<super::QueuesDownstreamRequest>>,
) -> std::result::Result<
tonic::Response<Self::QueuesDownstreamStream>,
tonic::Status,
>;
type QueuesUpstreamStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::QueuesUpstreamResponse, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn queues_upstream(
&self,
request: tonic::Request<tonic::Streaming<super::QueuesUpstreamRequest>>,
) -> std::result::Result<
tonic::Response<Self::QueuesUpstreamStream>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct KubemqServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> KubemqServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for KubemqServer<T>
where
T: Kubemq,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/kubemq.kubemq/SendEvent" => {
#[allow(non_camel_case_types)]
struct SendEventSvc<T: Kubemq>(pub Arc<T>);
impl<T: Kubemq> tonic::server::UnaryService<super::Event>
for SendEventSvc<T> {
type Response = super::Result;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Event>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::send_event(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SendEventSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/SendEventsStream" => {
#[allow(non_camel_case_types)]
struct SendEventsStreamSvc<T: Kubemq>(pub Arc<T>);
impl<T: Kubemq> tonic::server::StreamingService<super::Event>
for SendEventsStreamSvc<T> {
type Response = super::Result;
type ResponseStream = T::SendEventsStreamStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<tonic::Streaming<super::Event>>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::send_events_stream(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SendEventsStreamSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/SubscribeToEvents" => {
#[allow(non_camel_case_types)]
struct SubscribeToEventsSvc<T: Kubemq>(pub Arc<T>);
impl<
T: Kubemq,
> tonic::server::ServerStreamingService<super::Subscribe>
for SubscribeToEventsSvc<T> {
type Response = super::EventReceive;
type ResponseStream = T::SubscribeToEventsStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Subscribe>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::subscribe_to_events(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SubscribeToEventsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/SubscribeToRequests" => {
#[allow(non_camel_case_types)]
struct SubscribeToRequestsSvc<T: Kubemq>(pub Arc<T>);
impl<
T: Kubemq,
> tonic::server::ServerStreamingService<super::Subscribe>
for SubscribeToRequestsSvc<T> {
type Response = super::Request;
type ResponseStream = T::SubscribeToRequestsStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Subscribe>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::subscribe_to_requests(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SubscribeToRequestsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/SendRequest" => {
#[allow(non_camel_case_types)]
struct SendRequestSvc<T: Kubemq>(pub Arc<T>);
impl<T: Kubemq> tonic::server::UnaryService<super::Request>
for SendRequestSvc<T> {
type Response = super::Response;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Request>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::send_request(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SendRequestSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/SendResponse" => {
#[allow(non_camel_case_types)]
struct SendResponseSvc<T: Kubemq>(pub Arc<T>);
impl<T: Kubemq> tonic::server::UnaryService<super::Response>
for SendResponseSvc<T> {
type Response = super::Empty;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Response>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::send_response(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SendResponseSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/SendQueueMessage" => {
#[allow(non_camel_case_types)]
struct SendQueueMessageSvc<T: Kubemq>(pub Arc<T>);
impl<T: Kubemq> tonic::server::UnaryService<super::QueueMessage>
for SendQueueMessageSvc<T> {
type Response = super::SendQueueMessageResult;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueueMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::send_queue_message(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SendQueueMessageSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/SendQueueMessagesBatch" => {
#[allow(non_camel_case_types)]
struct SendQueueMessagesBatchSvc<T: Kubemq>(pub Arc<T>);
impl<
T: Kubemq,
> tonic::server::UnaryService<super::QueueMessagesBatchRequest>
for SendQueueMessagesBatchSvc<T> {
type Response = super::QueueMessagesBatchResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueueMessagesBatchRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::send_queue_messages_batch(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SendQueueMessagesBatchSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/ReceiveQueueMessages" => {
#[allow(non_camel_case_types)]
struct ReceiveQueueMessagesSvc<T: Kubemq>(pub Arc<T>);
impl<
T: Kubemq,
> tonic::server::UnaryService<super::ReceiveQueueMessagesRequest>
for ReceiveQueueMessagesSvc<T> {
type Response = super::ReceiveQueueMessagesResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ReceiveQueueMessagesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::receive_queue_messages(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ReceiveQueueMessagesSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/StreamQueueMessage" => {
#[allow(non_camel_case_types)]
struct StreamQueueMessageSvc<T: Kubemq>(pub Arc<T>);
impl<
T: Kubemq,
> tonic::server::StreamingService<super::StreamQueueMessagesRequest>
for StreamQueueMessageSvc<T> {
type Response = super::StreamQueueMessagesResponse;
type ResponseStream = T::StreamQueueMessageStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::StreamQueueMessagesRequest>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::stream_queue_message(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = StreamQueueMessageSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/AckAllQueueMessages" => {
#[allow(non_camel_case_types)]
struct AckAllQueueMessagesSvc<T: Kubemq>(pub Arc<T>);
impl<
T: Kubemq,
> tonic::server::UnaryService<super::AckAllQueueMessagesRequest>
for AckAllQueueMessagesSvc<T> {
type Response = super::AckAllQueueMessagesResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AckAllQueueMessagesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::ack_all_queue_messages(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = AckAllQueueMessagesSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/Ping" => {
#[allow(non_camel_case_types)]
struct PingSvc<T: Kubemq>(pub Arc<T>);
impl<T: Kubemq> tonic::server::UnaryService<super::Empty>
for PingSvc<T> {
type Response = super::PingResult;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Empty>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::ping(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = PingSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/QueuesDownstream" => {
#[allow(non_camel_case_types)]
struct QueuesDownstreamSvc<T: Kubemq>(pub Arc<T>);
impl<
T: Kubemq,
> tonic::server::StreamingService<super::QueuesDownstreamRequest>
for QueuesDownstreamSvc<T> {
type Response = super::QueuesDownstreamResponse;
type ResponseStream = T::QueuesDownstreamStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::QueuesDownstreamRequest>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::queues_downstream(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = QueuesDownstreamSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/kubemq.kubemq/QueuesUpstream" => {
#[allow(non_camel_case_types)]
struct QueuesUpstreamSvc<T: Kubemq>(pub Arc<T>);
impl<
T: Kubemq,
> tonic::server::StreamingService<super::QueuesUpstreamRequest>
for QueuesUpstreamSvc<T> {
type Response = super::QueuesUpstreamResponse;
type ResponseStream = T::QueuesUpstreamStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::QueuesUpstreamRequest>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kubemq>::queues_upstream(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = QueuesUpstreamSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for KubemqServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "kubemq.kubemq";
impl<T> tonic::server::NamedService for KubemqServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}