@@ -406,7 +406,7 @@ pub struct Permissions<'a> {
406406
407407pub ( crate ) const SHOVEL_COMPONENT : & str = "shovel" ;
408408
409- /// Represents a dynamic shovel definition.
409+ /// Represents a dynamic AMQP 0-9-1 shovel definition.
410410#[ derive( Serialize ) ]
411411pub struct Amqp091ShovelParams < ' a > {
412412 pub name : & ' a str ,
@@ -423,6 +423,9 @@ impl<'a> From<Amqp091ShovelParams<'a>> for RuntimeParameterDefinition<'a> {
423423 fn from ( params : Amqp091ShovelParams < ' a > ) -> Self {
424424 let mut value = Map :: new ( ) ;
425425
426+ value. insert ( "src-protocol" . to_owned ( ) , json ! ( "amqp091" ) ) ;
427+ value. insert ( "dest-protocol" . to_owned ( ) , json ! ( "amqp091" ) ) ;
428+
426429 value. insert ( "src-uri" . to_owned ( ) , json ! ( params. source. source_uri) ) ;
427430 if let Some ( sq) = params. source . source_queue {
428431 value. insert ( "src-queue" . to_owned ( ) , json ! ( sq) ) ;
@@ -614,6 +617,85 @@ impl<'a> Amqp091ShovelDestinationParams<'a> {
614617 }
615618}
616619
620+ /// Represents a dynamic shovel definition.
621+ #[ derive( Serialize ) ]
622+ pub struct Amqp10ShovelParams < ' a > {
623+ pub name : & ' a str ,
624+ pub vhost : & ' a str ,
625+
626+ pub acknowledgement_mode : ShovelAcknowledgementMode ,
627+ pub reconnect_delay : Option < u16 > ,
628+
629+ pub source : Amqp10ShovelSourceParams < ' a > ,
630+ pub destination : Amqp10ShovelDestinationParams < ' a > ,
631+ }
632+
633+ #[ derive( Serialize ) ]
634+ pub struct Amqp10ShovelSourceParams < ' a > {
635+ pub source_uri : & ' a str ,
636+ pub source_address : & ' a str ,
637+ }
638+
639+ impl < ' a > Amqp10ShovelSourceParams < ' a > {
640+ pub fn new ( uri : & ' a str , address : & ' a str ) -> Self {
641+ Self {
642+ source_uri : uri,
643+ source_address : address,
644+ }
645+ }
646+ }
647+
648+ impl < ' a > From < Amqp10ShovelParams < ' a > > for RuntimeParameterDefinition < ' a > {
649+ fn from ( params : Amqp10ShovelParams < ' a > ) -> Self {
650+ let mut value = Map :: new ( ) ;
651+
652+ value. insert ( "src-protocol" . to_owned ( ) , json ! ( "amqp10" ) ) ;
653+ value. insert ( "dest-protocol" . to_owned ( ) , json ! ( "amqp10" ) ) ;
654+
655+ value. insert ( "src-uri" . to_owned ( ) , json ! ( params. source. source_uri) ) ;
656+ value. insert (
657+ "src-address" . to_owned ( ) ,
658+ json ! ( params. source. source_address) ,
659+ ) ;
660+
661+ value. insert (
662+ "dest-uri" . to_owned ( ) ,
663+ json ! ( params. destination. destination_uri) ,
664+ ) ;
665+ value. insert (
666+ "dest-address" . to_owned ( ) ,
667+ json ! ( params. destination. destination_address) ,
668+ ) ;
669+
670+ value. insert ( "ack-mode" . to_owned ( ) , json ! ( params. acknowledgement_mode) ) ;
671+ if let Some ( val) = params. reconnect_delay {
672+ value. insert ( "reconnect-delay" . to_owned ( ) , json ! ( val) ) ;
673+ }
674+
675+ Self {
676+ name : params. name ,
677+ vhost : params. vhost ,
678+ component : SHOVEL_COMPONENT ,
679+ value,
680+ }
681+ }
682+ }
683+
684+ #[ derive( Serialize ) ]
685+ pub struct Amqp10ShovelDestinationParams < ' a > {
686+ pub destination_uri : & ' a str ,
687+ pub destination_address : & ' a str ,
688+ }
689+
690+ impl < ' a > Amqp10ShovelDestinationParams < ' a > {
691+ pub fn new ( uri : & ' a str , address : & ' a str ) -> Self {
692+ Self {
693+ destination_uri : uri,
694+ destination_address : address,
695+ }
696+ }
697+ }
698+
617699pub type MessageProperties = Map < String , Value > ;
618700
619701#[ derive( Serialize , Default ) ]
0 commit comments