pub fn send(&self, message: StanMessage) -> impl Future<Item = (), Error = RatsioError> {
        let mut pub_msg = PubMsg::new();
        let mut hasher = Sha256::new();
        hasher.input(&message.payload[..]);
        pub_msg.set_sha256(Vec::from(&hasher.result()[..]));

        pub_msg.set_clientID(self.client_id.clone());
        pub_msg.set_subject(message.subject.clone());
        pub_msg.set_data(message.payload);
        if let Some(reply_to) = message.reply_to {
            pub_msg.set_reply(reply_to);
        }
        let conn_id = self.conn_id.read().clone();
        trace!(target: "ratsio", "Sending conn id {}", ::std::str::from_utf8(&conn_id[..]).unwrap());
        pub_msg.set_connID(conn_id);
        let guid = self.id_generator.write().next();
        pub_msg.set_guid(guid.clone());
        self.pub_ack_map.write().insert(guid, 0);

        let payload = ProtoMessage::write_to_bytes(&pub_msg).unwrap();
        let publ = Publish::builder()
            .subject(format!(
                "{}.{}",
                self.client_info.read().pub_prefix,
                message.subject
            ))
            .payload(payload)
            .build()
            .unwrap();
        trace!(target: "ratsio", "publishing to topic : {}", publ.subject);
        self.nats_client.publish(publ)
    }
/// Sends an OP to the server
Sends an OP to the server
Sends an OP to the server
pub fn send(&self, message: StanMessage) -> impl Future<Item = (), Error = RatsioError> {
        let mut pub_msg = PubMsg::new();
        let mut hasher = Sha256::new();
        hasher.input(&message.payload[..]);
        pub_msg.set_sha256(Vec::from(&hasher.result()[..]));
        pub_msg.set_clientID(self.client_id.clone());
        pub_msg.set_subject(message.subject.clone());
        pub_msg.set_data(message.payload);
        if let Some(reply_to) = message.reply_to {
            pub_msg.set_reply(reply_to);
        }
        let conn_id = self.conn_id.read().clone();
        trace!(target: "ratsio", "Sending conn id {}", ::std::str::from_utf8(&conn_id[..]).unwrap());
        pub_msg.set_connID(conn_id);
        let guid = self.id_generator.write().next();
        pub_msg.set_guid(guid.clone());
        self.pub_ack_map.write().insert(guid, 0);
        let payload = ProtoMessage::write_to_bytes(&pub_msg).unwrap();
        let publ = Publish::builder()
            .subject(format!(
                "{}.{}",
                self.client_info.read().pub_prefix,
                message.subject
            ))
            .payload(payload)
            .build()
            .unwrap();
        trace!(target: "ratsio", "publishing to topic : {}", publ.subject);
        self.nats_client.publish(publ)
    }
pub fn send ( & self , message : StanMessage ) -> impl Future < Item = ( ) , Error = RatsioError > { let mut pub_msg = PubMsg :: new ( ) ; let mut hasher = Sha256 :: new ( ) ; hasher . input ( & message . payload [ .. ] ) ; pub_msg . set_sha256 ( Vec :: from ( & hasher . result ( ) [ .. ] ) ) ; pub_msg . set_clientID ( self . client_id . clone ( ) ) ; pub_msg . set_subject ( message . subject . clone ( ) ) ; pub_msg . set_data ( message . payload ) ; if let Some ( reply_to ) = message . reply_to { pub_msg . set_reply ( reply_to ) ; } let conn_id = self . conn_id . read ( ) . clone ( ) ; trace ! ( target " " " " std str from_utf8 ( conn_id [ ] ) unwrap ( ) ) ; pub_msg . set_connID ( conn_id ) ; let guid = self . id_generator . write ( ) . next ( ) ; pub_msg . set_guid ( guid . clone ( ) ) ; self . pub_ack_map . write ( ) . insert ( guid , 0 ) ; let payload = ProtoMessage :: write_to_bytes ( & pub_msg ) . unwrap ( ) ; let publ = Publish :: builder ( ) . subject ( format ! ( " " self client_info read ( ) pub_prefix message subject ) ) . payload ( payload ) . build ( ) . unwrap ( ) ; trace ! ( target " " " " publ subject ) ; self . nats_client . publish ( publ ) }
Sends an OP to the server
Sends an OP to the server
&self
message
StanMessage
&self
message
StanMessage