prosody 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,9 +100,26 @@ impl Message {
100
100
  /// # Errors
101
101
  ///
102
102
  /// Returns an error if payload deserialization fails.
103
+ ///
104
+ /// The public RBS exposes this JSON value as `Message[Payload]#payload`.
105
+ /// That generic parameter is static-only: this native boundary continues
106
+ /// to deserialize JSON into ordinary Ruby objects without runtime schema
107
+ /// validation.
103
108
  fn payload(ruby: &Ruby, this: &Self) -> Result<Value, Error> {
104
109
  serialize(ruby, this.inner.payload())
105
110
  }
111
+
112
+ /// Clones the wrapped `ConsumerMessage` for a message-collection write.
113
+ ///
114
+ /// The wrapper holds the real `ConsumerMessage`, so a message write clones
115
+ /// the inner value directly — a cheap operation.
116
+ ///
117
+ /// # Returns
118
+ ///
119
+ /// An owned clone of the wrapped `ConsumerMessage`.
120
+ pub(crate) fn consumer_message(&self) -> ConsumerMessage<serde_json::Value> {
121
+ self.inner.clone()
122
+ }
106
123
  }
107
124
 
108
125
  impl From<ConsumerMessage<serde_json::Value>> for Message {
@@ -38,6 +38,7 @@ use tracing_opentelemetry::OpenTelemetrySpanExt;
38
38
 
39
39
  mod context;
40
40
  mod message;
41
+ mod state;
41
42
  mod trigger;
42
43
 
43
44
  /// A handler that bridges between Kafka messages and Ruby message processing
@@ -117,7 +118,7 @@ impl FallibleHandler for RubyHandler {
117
118
  _demand_type: DemandType,
118
119
  ) -> Result<(), Self::Error>
119
120
  where
120
- C: EventContext,
121
+ C: EventContext<Payload = Self::Payload>,
121
122
  {
122
123
  // Create a new span for the on_message operation as a child of the message's
123
124
  // span
@@ -207,7 +208,7 @@ impl FallibleHandler for RubyHandler {
207
208
  _demand_type: DemandType,
208
209
  ) -> Result<(), Self::Error>
209
210
  where
210
- C: EventContext,
211
+ C: EventContext<Payload = Self::Payload>,
211
212
  {
212
213
  // Only process application timers; internal timers are handled by middleware
213
214
  if trigger.timer_type != TimerType::Application {
@@ -340,6 +341,7 @@ pub enum RubyHandlerError {
340
341
  pub fn init(ruby: &Ruby) -> Result<(), Error> {
341
342
  context::init(ruby)?;
342
343
  message::init(ruby)?;
344
+ state::init(ruby)?;
343
345
  trigger::init(ruby)?;
344
346
 
345
347
  Ok(())