@@ -9,9 +9,10 @@ use rdkafka::{
9
9
Message as _,
10
10
} ;
11
11
use svix_bridge_types:: {
12
- async_trait, svix:: api:: Svix , CreateMessageRequest , JsObject , SenderInput , SenderOutputOpts ,
13
- TransformationConfig , TransformerInput , TransformerInputFormat , TransformerJob ,
14
- TransformerOutput , TransformerTx ,
12
+ async_trait,
13
+ svix:: api:: { MessageCreateOptions , Svix } ,
14
+ CreateMessageRequest , JsObject , SenderInput , SenderOutputOpts , TransformationConfig ,
15
+ TransformerInput , TransformerInputFormat , TransformerJob , TransformerOutput , TransformerTx ,
15
16
} ;
16
17
use tokio:: task:: spawn_blocking;
17
18
@@ -69,27 +70,26 @@ impl KafkaConsumer {
69
70
serde_json:: from_slice ( payload) . map_err ( Error :: Deserialization ) ?
70
71
} ;
71
72
72
- let CreateMessageRequest {
73
- app_id,
74
- message,
75
- mut post_options,
76
- } = payload;
73
+ let CreateMessageRequest { app_id, message } = payload;
77
74
78
75
let KafkaInputOpts :: Inner {
79
76
group_id, topic, ..
80
77
} = & self . opts ;
81
78
82
- // If committing the message fails or the process crashes after posting the webhook but
83
- // before committing, this makes sure that the next run of this fn with the same kafka
84
- // message doesn't end up creating a duplicate webhook in svix.
85
- let idempotency_key = format ! ( "svix_bridge_kafka_{group_id}_{topic}_{}" , msg. offset( ) ) ;
86
- post_options
87
- . get_or_insert_with ( Default :: default)
88
- . idempotency_key = Some ( idempotency_key) ;
79
+ let options = MessageCreateOptions {
80
+ with_content : None ,
81
+ // If committing the message fails or the process crashes after posting the webhook but
82
+ // before committing, this makes sure that the next run of this fn with the same kafka
83
+ // message doesn't end up creating a duplicate webhook in svix.
84
+ idempotency_key : Some ( format ! (
85
+ "svix_bridge_kafka_{group_id}_{topic}_{}" ,
86
+ msg. offset( )
87
+ ) ) ,
88
+ } ;
89
89
90
90
self . svix_client
91
91
. message ( )
92
- . create ( app_id, message, post_options . map ( Into :: into ) )
92
+ . create ( app_id, message, Some ( options ) )
93
93
. await ?;
94
94
95
95
Ok ( ( ) )
0 commit comments