|
17 | 17 | import io.dapr.client.domain.BulkPublishRequest; |
18 | 18 | import io.dapr.client.domain.BulkPublishResponse; |
19 | 19 | import io.dapr.client.domain.BulkPublishResponseFailedEntry; |
| 20 | +import io.dapr.client.domain.CloudEvent; |
20 | 21 | import io.dapr.client.domain.ConversationRequest; |
21 | 22 | import io.dapr.client.domain.ConversationRequestAlpha2; |
22 | 23 | import io.dapr.client.domain.ConversationResponse; |
|
32 | 33 | import io.dapr.client.domain.UnlockResponseStatus; |
33 | 34 | import io.dapr.client.domain.query.Query; |
34 | 35 | import io.dapr.utils.TypeRef; |
| 36 | +import reactor.core.publisher.Flux; |
35 | 37 | import reactor.core.publisher.Mono; |
36 | 38 |
|
37 | 39 | import java.util.List; |
@@ -271,12 +273,24 @@ <T> Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicNa |
271 | 273 | * @param topic Name of the topic to subscribe to. |
272 | 274 | * @param listener Callback methods to process events. |
273 | 275 | * @param type Type for object deserialization. |
274 | | - * @return An active subscription. |
275 | 276 | * @param <T> Type of object deserialization. |
| 277 | + * @return An active subscription. |
| 278 | + * @deprecated Use {@link #subscribeToEvents(String, String, TypeRef)} instead for a more reactive approach. |
276 | 279 | */ |
| 280 | + @Deprecated |
277 | 281 | <T> Subscription subscribeToEvents( |
278 | 282 | String pubsubName, String topic, SubscriptionListener<T> listener, TypeRef<T> type); |
279 | 283 |
|
| 284 | + /** |
| 285 | + * Subscribe to pubsub events via streaming using Project Reactor Flux. |
| 286 | + * @param pubsubName Name of the pubsub component. |
| 287 | + * @param topic Name of the topic to subscribe to. |
| 288 | + * @param type Type for object deserialization. |
| 289 | + * @return A Flux of CloudEvents containing deserialized event payloads and metadata. |
| 290 | + * @param <T> Type of the event payload. |
| 291 | + */ |
| 292 | + <T> Flux<CloudEvent<T>> subscribeToEvents(String pubsubName, String topic, TypeRef<T> type); |
| 293 | + |
280 | 294 | /** |
281 | 295 | * Schedules a job using the provided job request details. |
282 | 296 | * |
|
0 commit comments