Java Code Examples for org.eclipse.microprofile.reactive.messaging.Message#ack()
The following examples show how to use
org.eclipse.microprofile.reactive.messaging.Message#ack() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IncomingCamelMetadataExample.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Incoming("files") public CompletionStage<Void> consume(Message<GenericFile<File>> msg) { Optional<IncomingExchangeMetadata> metadata = msg.getMetadata(IncomingExchangeMetadata.class); if (metadata.isPresent()) { // Retrieve the camel exchange: Exchange exchange = metadata.get().getExchange(); } return msg.ack(); }
Example 2
Source File: AbstractMediator.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
protected CompletionStage<Message<?>> getAckOrCompletion(Message<?> message) { CompletionStage<Void> ack = message.ack(); if (ack != null) { return ack.thenApply(x -> message); } else { return CompletableFuture.completedFuture(message); } }
Example 3
Source File: KafkaPriceMessageConsumer.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Incoming("prices") public CompletionStage<Void> consume(Message<Double> price) { // process your price. System.out.println( "KafkaPriceMessageConsumer: consume " + price.getPayload()); // Acknowledge the incoming message (commit the offset) return price.ack(); }
Example 4
Source File: KafkaPriceMessageConsumer.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Incoming("prices") public CompletionStage<Void> consume(Message<Double> price) { // process your price. // Acknowledge the incoming message (commit the offset) return price.ack(); }
Example 5
Source File: KafkaPriceMessageConsumer.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "rawtypes" }) @Incoming("prices") public CompletionStage<Void> consume(Message<Double> price) { // process your price. list.add(price.getPayload()); Optional<IncomingKafkaRecordMetadata> metadata = price.getMetadata(IncomingKafkaRecordMetadata.class); metadata.orElseThrow(() -> new IllegalArgumentException("Metadata are missing")); // Acknowledge the incoming message (commit the offset) return price.ack(); }
Example 6
Source File: MyBeanEmittingPayloadsWithAck.java From microprofile-reactive-messaging with Apache License 2.0 | 5 votes |
@Incoming("foo") @Acknowledgment(Strategy.MANUAL) public CompletionStage<Void> consume(final Message<String> s) { list.add(s.getPayload()); if (!"c".equals(s.getPayload())) { return s.ack(); } else { return new CompletableFuture<>(); } }
Example 7
Source File: MqttPriceMessageConsumer.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Incoming("prices") public CompletionStage<Void> consume(Message<byte[]> price) { // process your price. // Acknowledge the incoming message return price.ack(); }
Example 8
Source File: PriceMessageConsumer.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Incoming("prices") public CompletionStage<Void> consume(Message<Double> price) { // process your price. // TASK - Explain acknowledgement // Acknowledge the incoming message return price.ack(); }
Example 9
Source File: JmsPriceMessageConsumer.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Incoming("prices") public CompletionStage<Void> consume(Message<Double> price) { // process your price. // Acknowledge the incoming message return price.ack(); }
Example 10
Source File: CamelFileMessageConsumer.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Incoming("files") public CompletionStage<Void> consume(Message<GenericFile<File>> msg) { File file = msg.getPayload().getFile(); // process the file return msg.ack(); }
Example 11
Source File: AckChainTest.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Incoming("C") public CompletionStage<Void> consume(Message<String> m) { return m.ack(); }
Example 12
Source File: MetadataWithPayloadChainExamples.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Outgoing("sink") public CompletionStage<Void> consume(Message<Integer> in) { Optional<MyMetadata> metadata = in.getMetadata(MyMetadata.class); return in.ack(); }
Example 13
Source File: MetadataWithMessageChainExamples.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Outgoing("sink") public CompletionStage<Void> consume(Message<Integer> in) { Optional<MyMetadata> metadata = in.getMetadata(MyMetadata.class); return in.ack(); }
Example 14
Source File: SubscriberSignatureTest.java From quarkus with Apache License 2.0 | 4 votes |
@Incoming("D") public CompletionStage<Void> consume(Message<Integer> message) { getItems().add(message.getPayload()); getMessages().add(message); return message.ack(); }
Example 15
Source File: BeanWithStreamTransformers.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Incoming("sink-" + DEFAULT_ACKNOWLEDGMENT_BUILDER) public CompletionStage<Void> sinkDefaultBuilder(Message<String> in) { return in.ack(); }
Example 16
Source File: HttpSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Incoming("sink") public CompletionStage<Void> receive(Message<?> m) { list.add((HttpMessage<?>) m); return m.ack(); }
Example 17
Source File: FileMessageConsumer.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Incoming("files") public CompletionStage<Void> consume(Message<GenericFile<File>> msg) { File actualFile = msg.getPayload().getFile(); list.add(actualFile.getName()); return msg.ack(); }
Example 18
Source File: BeanWithCamelSourceUsingRegularRoute.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Incoming("data") public CompletionStage<Void> sink(Message<String> msg) { list.add(msg.getPayload()); return msg.ack(); }
Example 19
Source File: BeanWithProcessorsManipulatingMessages.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Incoming("sink") @Merge @Acknowledgment(Acknowledgment.Strategy.MANUAL) public CompletionStage<Void> justTheSink(Message<String> in) { return in.ack(); }
Example 20
Source File: BeanWithStreamTransformers.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Incoming("sink-" + DEFAULT_ACKNOWLEDGMENT) public CompletionStage<Void> sinkDefault(Message<String> in) { return in.ack(); }