From aff8ae8b8669fb7d02351233a6afdfe2eed0c9b9 Mon Sep 17 00:00:00 2001 From: Tomas Langer Date: Mon, 7 Feb 2022 15:45:45 +0100 Subject: [PATCH] Switch to Jakarta (#141) * Jakarta EE 9.1 alignment - use parent pom.xml Co-authored-by: Roberto Cortez --- api/pom.xml | 135 +--- .../reactive/messaging/Acknowledgment.java | 720 ++++++++++++------ .../reactive/messaging/Channel.java | 22 +- .../reactive/messaging/Emitter.java | 54 +- .../reactive/messaging/Incoming.java | 36 +- .../reactive/messaging/Message.java | 99 +-- .../reactive/messaging/OnOverflow.java | 33 +- .../reactive/messaging/Outgoing.java | 18 +- .../reactive/messaging/package-info.java | 8 +- .../reactive/messaging/spi/Connector.java | 24 +- .../messaging/spi/ConnectorAttribute.java | 25 +- .../messaging/spi/ConnectorAttributes.java | 6 +- .../messaging/spi/ConnectorFactory.java | 6 +- .../messaging/spi/ConnectorLiteral.java | 17 +- .../spi/IncomingConnectorFactory.java | 71 +- .../spi/OutgoingConnectorFactory.java | 68 +- .../reactive/messaging/spi/package-info.java | 26 +- .../main/javadoc/licenses/Draft/license.html | 47 -- .../main/javadoc/licenses/Final/license.html | 92 --- .../Draft => api/src/main/resources}/LICENSE | 4 +- api/src/main/resources/NOTICE | 16 + approach.asciidoc | 4 +- mp_checkstyle_rules.xml | 95 --- pom.xml | 406 +--------- spec/pom.xml | 92 +-- spec/src/main/asciidoc/license-alv2.asciidoc | 2 +- spec/src/main/asciidoc/rationale.asciidoc | 22 +- src/license/license.txt | 17 - tck/pom.xml | 100 +-- .../messaging/tck/ArchiveExtender.java | 4 +- .../reactive/messaging/tck/BeanWithChain.java | 66 +- .../messaging/tck/ProcessorChainTest.java | 19 +- .../messaging/tck/SimpleIncomingBean.java | 15 +- .../messaging/tck/SimpleIncomingTest.java | 46 +- .../reactive/messaging/tck/StringSource.java | 23 +- .../reactive/messaging/tck/TckBase.java | 14 +- .../messaging/tck/ValueCollector.java | 10 +- .../AsynchronousMessageProcessorAckTest.java | 72 +- .../AsynchronousMessageSubscriberAckTest.java | 75 +- .../AsynchronousPayloadProcessorAckTest.java | 74 +- .../AsynchronousPayloadSubscriberAckTest.java | 73 +- .../tck/acknowledgement/EmitterBean.java | 6 +- .../EmitterOfMessageAcknowledgementTest.java | 26 +- .../EmitterOfPayloadAcknowledgementTest.java | 47 +- .../MessageProcessorAckTest.java | 69 +- .../PayloadProcessorAckTest.java | 69 +- .../PayloadSubscriberAckTest.java | 69 +- ...jectedWithAPublisherBuilderOfMessages.java | 13 +- ...jectedWithAPublisherBuilderOfPayloads.java | 10 +- .../BeanInjectedWithAPublisherOfMessages.java | 10 +- .../BeanInjectedWithAPublisherOfPayloads.java | 10 +- ...dWithDifferentFlavorsOfTheSameChannel.java | 15 +- .../tck/channel/BeanWithMissingChannel.java | 8 +- ...ectionDifferentFlavourSameChannelTest.java | 9 +- ...lInjectionPublisherBuilderMessageTest.java | 18 +- ...lInjectionPublisherBuilderPayloadTest.java | 19 +- .../ChannelInjectionPublisherPayloadTest.java | 18 +- .../ChannelInjectionPublisherTest.java | 20 +- .../channel/EmitterConnectedToProcessor.java | 12 +- ...njectionAfterTerminatingWithErrorTest.java | 14 +- ...tterInjectionConnectedToProcessorTest.java | 10 +- ...ctionEmittingDataAfterTerminationTest.java | 11 +- .../EmitterInjectionEmittingMessageTest.java | 13 +- .../EmitterInjectionEmittingNullTest.java | 13 +- ...ionMessageBeanWithPayloadsWithAckTest.java | 10 +- .../EmitterInjectionMissingChannelTest.java | 12 +- .../channel/EmitterInjectionPayloadsTest.java | 13 +- .../EmitterInjectionPayloadsWithAckTest.java | 11 +- .../MyBeanEmittingDataAfterTermination.java | 15 +- ...EmittingDataAfterTerminationWithError.java | 15 +- .../tck/channel/MyBeanEmittingMessages.java | 12 +- .../tck/channel/MyBeanEmittingNull.java | 18 +- .../tck/channel/MyBeanEmittingPayloads.java | 12 +- .../MyBeanEmittingPayloadsWithAck.java | 17 +- .../messaging/tck/channel/MyMessageBean.java | 4 +- .../MyMessageBeanEmittingPayloadsWithAck.java | 12 +- .../messaging/tck/channel/SourceBean.java | 7 +- .../BeanUsingBufferOverflowStrategy.java | 42 +- ...fferOverflowWithoutBufferSizeStrategy.java | 26 +- .../overflow/BeanUsingDefaultOverflow.java | 46 +- .../BeanUsingDropOverflowStrategy.java | 51 +- .../BeanUsingLatestOverflowStrategy.java | 52 +- .../BeanUsingThrowExceptionStrategy.java | 45 +- .../BeanWithFailOverflowStrategy.java | 34 +- .../BufferOverflowStrategyOverflowTest.java | 16 +- .../overflow/BufferOverflowStrategyTest.java | 17 +- .../DefaultOverflowStrategyOverflowTest.java | 12 +- ...StrategyOverflowWithoutBufferSizeTest.java | 24 +- .../overflow/DefaultOverflowStrategyTest.java | 15 +- .../DropOverflowStrategyOverflowTest.java | 13 +- .../overflow/DropOverflowStrategyTest.java | 14 +- .../FailOverflowStrategyOverflowTest.java | 10 +- .../LatestOverflowStrategyOverflowTest.java | 13 +- .../overflow/LatestOverflowStrategyTest.java | 13 +- ...ExceptionOverflowStrategyOverflowTest.java | 22 +- .../ThrowExceptionOverflowStrategyTest.java | 12 +- .../tck/connector/ConnectorTest.java | 32 +- .../tck/connector/DummyConnector.java | 19 +- .../tck/connector/MissingConnectorTest.java | 25 +- .../messaging/tck/connector/MyProcessor.java | 6 +- .../MyProcessorWithBadStreamName.java | 6 +- .../tck/extension/AssertJArchiveAppender.java | 2 +- .../extension/AwaitilityArchiveAppender.java | 2 +- .../ReactiveMessagingLoadableExtension.java | 2 +- .../tck/extension/RxJavaArchiveAppender.java | 2 +- .../tck/invalid/BeanConsumingManyTwice.java | 4 +- .../tck/invalid/BeanProducingManyTwice.java | 10 +- .../invalid/BeanWithBadOutgoingSignature.java | 10 +- .../tck/invalid/BeanWithEmptyIncoming.java | 3 +- .../tck/invalid/BeanWithEmptyOutgoing.java | 3 +- .../tck/invalid/BeanWithIncompleteChain.java | 21 +- .../tck/invalid/ChannelMissingUpstream.java | 10 +- .../tck/invalid/ChannelMultipleUpstreams.java | 14 +- .../tck/invalid/EmitterMissingDownstream.java | 10 +- .../invalid/EmitterMultipleDownstreams.java | 9 +- .../tck/invalid/InvalidConfigurationTest.java | 87 +-- .../invalid/ProcessorMissingDownstream.java | 4 +- .../tck/invalid/ProcessorMissingUpstream.java | 4 +- .../invalid/ProcessorMultipleDownstreams.java | 9 +- .../invalid/ProcessorMultipleUpstreams.java | 6 +- .../messaging/tck/metrics/ConfigAsset.java | 9 +- .../messaging/tck/metrics/MetricsTest.java | 13 +- .../tck/metrics/MetricsTestBean.java | 24 +- .../messaging/tck/metrics/TestConnector.java | 35 +- .../messaging/tck/scope/ApplicationBeans.java | 71 +- .../tck/scope/ApplicationScopeTest.java | 42 +- .../messaging/tck/scope/DependantBeans.java | 13 +- .../tck/scope/DependantScopeTest.java | 14 +- .../invalid/IncomingReturningNonVoid.java | 6 +- ...comingReturningNonVoidCompletionStage.java | 9 +- .../InvalidSubscriberSignatureTest.java | 17 +- .../processors/DirectProcessorBean.java | 224 +++--- .../signatures/processors/ProcessorBean.java | 263 ++++--- .../processors/ProcessorShapeTest.java | 65 +- .../signatures/processors/PublisherBean.java | 80 +- .../processors/TransformerBean.java | 260 +++---- .../signatures/publishers/PublisherBean.java | 46 +- .../publishers/PublisherShapeTest.java | 9 +- .../publishers/VerifierForPublisherBean.java | 84 +- .../subscribers/SubscriberBean.java | 52 +- .../subscribers/SubscriberShapeTest.java | 8 +- tck/src/main/licenses/Final/LICENSE | 83 -- tck/src/main/resources/META-INF/LICENSE | 201 +++++ tck/src/main/resources/META-INF/NOTICE | 16 + tck/src/main/resources/META-INF/tck | 0 145 files changed, 2627 insertions(+), 3217 deletions(-) delete mode 100644 api/src/main/javadoc/licenses/Draft/license.html delete mode 100644 api/src/main/javadoc/licenses/Final/license.html rename {tck/src/main/licenses/Draft => api/src/main/resources}/LICENSE (99%) create mode 100644 api/src/main/resources/NOTICE delete mode 100644 mp_checkstyle_rules.xml delete mode 100644 src/license/license.txt delete mode 100644 tck/src/main/licenses/Final/LICENSE create mode 100644 tck/src/main/resources/META-INF/LICENSE create mode 100644 tck/src/main/resources/META-INF/NOTICE create mode 100644 tck/src/main/resources/META-INF/tck diff --git a/api/pom.xml b/api/pom.xml index b549f30f..c3fe6f2f 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -1,7 +1,7 @@ org.eclipse.microprofile.reactive.messaging microprofile-reactive-messaging-parent - 2.1-SNAPSHOT + 3.0-SNAPSHOT - - false - microprofile-reactive-messaging-api MicroProfile Reactive Messaging API MicroProfile Reactive Messaging :: API + org.osgi @@ -60,142 +58,21 @@ - - maven-resources-plugin - 3.2.0 - - - copy-resources - validate - - copy-resources - - - ${basedir}/target/apidocs/doc-files/ - true - - - src/main/javadoc/licenses/${revremark}/ - true - - - - - - org.apache.maven.plugins maven-javadoc-plugin - - - attach-javadocs - - jar - - - - false - true - true - none - ${project.name} - ${project.name} -
${project.name} v${project.version}]]>
- - - Use is subject to license terms. - ]]> - true true - https://docs.jboss.org/cdi/api/${cdi-api.version}/ - https://download.eclipse.org/microprofile/microprofile-reactive-streams-operators-${microprofile.reactive.streams.operators.version}/apidocs/ - https://download.eclipse.org/microprofile/microprofile-config-${microprofile-config-api.version}/apidocs/ + https://jakarta.ee/specifications/cdi/3.0/apidocs/ + https://download.eclipse.org/microprofile/microprofile-reactive-streams-operators-${version.microprofile.reactive.streams.operators}/apidocs/ + https://download.eclipse.org/microprofile/microprofile-config-${version.microprofile.config}/apidocs/ https://osgi.org/javadoc/r6/annotation/
- - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - biz.aQute.bnd - bnd-maven-plugin - 4.2.0 - - - - - bnd-process - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - org.eclipse.microprofile.reactive.messaging - MicroProfile Reactive Messaging Bundle - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - biz.aQute.bnd - bnd-baseline-maven-plugin - 4.2.0 - - - 1.0 - - - - - baseline - - baseline - - - -
- - - eclipse-jarsigner - - - - org.eclipse.cbi.maven.plugins - eclipse-jarsigner-plugin - - - - sign - - - - - - - - - diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Acknowledgment.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Acknowledgment.java index 78f89f12..f9318d94 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Acknowledgment.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Acknowledgment.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -26,23 +26,25 @@ * * Reactive Messaging proposes four acknowledgement strategies: *
    - *
  • MANUAL: the acknowledgement (positive or negative) is up to the user. This is the default strategy - * for methods ingesting or producing {@link Message}. - *
  • - *
  • POST_PROCESSING: acknowledges the incoming message once the produced message is acknowledged. - * This is the default strategy for methods ingesting or producing single payloads.
  • - *
  • PRE_PROCESSING: acknowledges the incoming messages before calling the method.
  • - *
  • NONE: do not apply any acknowledgement.
  • + *
  • MANUAL: the acknowledgement (positive or negative) is up to the user. This is the default strategy + * for methods ingesting or producing {@link Message}.
  • + *
  • POST_PROCESSING: acknowledges the incoming message once the produced message is acknowledged. This + * is the default strategy for methods ingesting or producing single payloads.
  • + *
  • PRE_PROCESSING: acknowledges the incoming messages before calling the method.
  • + *
  • NONE: do not apply any acknowledgement.
  • *
* * The set of supported acknowledgment policies depends on the method signature. The following list gives the supported * strategies for some common use cases. * *
    - *
  • @Incoming("channel") void method(I payload): Post-processing (default), Pre-processing, None
  • - *
  • @Incoming("channel") CompletionStage<?> method(I payload): Post-processing (default), Pre-processing, None
  • - *
  • @Incoming("in") @Outgoing("out") Message<O> method(Message<I> msg): , Manual (default), Pre-processing, None
  • - *
  • @Incoming("in") @Outgoing("out") O method(I payload): Post-Processing (default), Pre-processing, None
  • + *
  • @Incoming("channel") void method(I payload): Post-processing (default), Pre-processing, None
  • + *
  • @Incoming("channel") CompletionStage<?> method(I payload): Post-processing (default), + * Pre-processing, None
  • + *
  • @Incoming("in") @Outgoing("out") Message<O> method(Message<I> msg): , Manual (default), + * Pre-processing, None
  • + *
  • @Incoming("in") @Outgoing("out") O method(I payload): Post-Processing (default), Pre-processing, + * None
  • *
* * Note that all messages must be acknowledged. An absence of acknowledgment is considered as a failure. @@ -53,269 +55,511 @@ * * * Signature - * Default Acknowledgement Strategy + * Default Acknowledgement + * Strategy * Supported Strategies * - * - * + * * - *
- *
- *
@Incoming("channel")
- * Subscriber<Message<I>> method()
- *
- *
- *

Manual

- *

None, Pre-Processing, Post-Processing (when - * the onNext method returns), Manual

+ *
+ * + *
+ * @Incoming("channel")
+ * Subscriber<Message<I>> method()
+ * 
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Pre-Processing, Post-Processing (when the onNext method returns), Manual + *

+ * * * - *
- *
- *
@Incoming("channel")
- * Subscriber<I> method()
- *
- *
- *

Post-Processing

- *

None, Pre-Processing, Post-Processing (when - * the onNext method returns)

+ *
+ * + *
+ * @Incoming("channel")
+ * Subscriber<I> method()
+ * 
+ * + *
+ * + *

+ * Post-Processing + *

+ * + * + *

+ * None, Pre-Processing, Post-Processing (when the onNext method returns) + *

+ * * * - *
- *
- *
@Incoming("channel")
- * SubscriberBuilder<Message<I>, Void> method()
- *
- *
- *

Manual

- *

None, Pre-Processing, Post-Processing (when - * the onNext method returns), Manual

+ *
+ * + *
+ * @Incoming("channel")
+ * SubscriberBuilder<Message<I>, Void> method()
+ * 
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Pre-Processing, Post-Processing (when the onNext method returns), Manual + *

+ * * * - *
- *
- *
@Incoming("channel")
- * SubscriberBuilder<I, Void> method()
- *
- *
- *

Post-Processing

- *

None, Pre-Processing, Post-Processing (when - * the onNext method returns)

+ *
+ * + *
+ * @Incoming("channel")
+ * SubscriberBuilder<I, Void> method()
+ * 
+ * + *
+ * + *

+ * Post-Processing + *

+ * + * + *

+ * None, Pre-Processing, Post-Processing (when the onNext method returns) + *

+ * * * - *
- *
- *
@Incoming("channel")
- * void method(I payload)
- *
- *
- *

Post-Processing

- *

None, Pre-Processing, Post-Processing (when - * the method returns)

+ *
+ * + *
+ * @Incoming("channel")
+ * void method(I payload)
+ * 
+ * + *
+ * + *

+ * Post-Processing + *

+ * + * + *

+ * None, Pre-Processing, Post-Processing (when the method returns) + *

+ * * * - *
- *
- *
@Incoming("channel")
- * CompletionStage<?> method(Message<I> msg)
- *
- *
- *

Manual

- *

None, Pre-Processing, Post-Processing (when - * the returned CompletionStage is completed), Manual

+ *
+ * + *
+ * @Incoming("channel")
+ * CompletionStage<?> method(Message<I> msg)
+ * 
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Pre-Processing, Post-Processing (when the returned CompletionStage is completed), Manual + *

+ * * * - *
- *
- *
@Incoming("channel")
- * CompletionStage<?> method(I payload)
- *
- *
- *

Post-Processing

- *

None, Pre-Processing, Post-Processing (when - * the returned CompletionStage is completed)

+ *
+ * + *
+ * @Incoming("channel")
+ * CompletionStage<?> method(I payload)
+ * 
+ * + *
+ * + *

+ * Post-Processing + *

+ * + * + *

+ * None, Pre-Processing, Post-Processing (when the returned CompletionStage is completed) + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * Processor<Message<I>, Message<O>> method()
- *
- *
- *

Manual

- *

None, Pre-Processing, Manual

+ * Processor<Message<I>, Message<O>> method()
+ *
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Pre-Processing, Manual + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * Processor<I, O> method();
- *
- *
- *

Pre-Processing

- *

None, Pre-Processing - * Post-Processing can be optionally supported by implementations, however it requires a 1:1 mapping between the incoming - * element and the outgoing element.

+ * Processor<I, O> method();
+ *
+ * + *
+ * + *

+ * Pre-Processing + *

+ * + * + *

+ * None, Pre-Processing Post-Processing can be optionally supported by implementations, however it requires a 1:1 + * mapping between the incoming element and the outgoing element. + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * ProcessorBuilder<Message<I>, Message<O>> method();
- *
- *
- *

Manual

- *

None, Pre-Processing, Manual

+ * ProcessorBuilder<Message<I>, Message<O>> method();
+ *
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Pre-Processing, Manual + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * ProcessorBuilder<I, O> method();
- *
- *
- *

Pre-Processing

- *

None, Pre-Processing - * Post-Processing can be optionally supported by implementations, however it requires a 1:1 mapping the incoming element - * and the outgoing element.

+ * ProcessorBuilder<I, O> method();
+ *
+ * + *
+ * + *

+ * Pre-Processing + *

+ * + * + *

+ * None, Pre-Processing Post-Processing can be optionally supported by implementations, however it requires a 1:1 + * mapping the incoming element and the outgoing element. + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * Publisher<Message<O>> method(Message<I> msg)
- *
- *
- *

Manual

- *

None, Manual, Pre-Processing

+ * Publisher<Message<O>> method(Message<I> msg)
+ *
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Manual, Pre-Processing + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * Publisher<O> method(I payload)
- *
- *
- *

Pre-Processing

- *

None, Pre-Processing

+ * Publisher<O> method(I payload)
+ *
+ * + *
+ * + *

+ * Pre-Processing + *

+ * + * + *

+ * None, Pre-Processing + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * PublisherBuilder<Message<O>> method(Message<I> msg)
- *
- *
- *

Manual

- *

None, Manual, Pre-Processing

+ * PublisherBuilder<Message<O>> method(Message<I> msg)
+ *
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Manual, Pre-Processing + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * PublisherBuilder<O> method(I payload)
- *
- *
- *

Pre-Processing

- *

None, Pre-Processing

+ * PublisherBuilder<O> method(I payload)
+ *
+ * + *
+ * + *

+ * Pre-Processing + *

+ * + * + *

+ * None, Pre-Processing + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * Message<O> method(Message<I> msg)
- *
- *
- *

Manual

- *

None, Manual, Pre-Processing

+ * Message<O> method(Message<I> msg)
+ *
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Manual, Pre-Processing + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * O method(I payload)
- *
- *
- *

Post-Processing

- *

None, Pre-Processing, Post-Processing (when - * the message wrapping the produced payload is acknowledged)

+ * O method(I payload)
+ *
+ * + *
+ * + *

+ * Post-Processing + *

+ * + * + *

+ * None, Pre-Processing, Post-Processing (when the message wrapping the produced payload is acknowledged) + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * CompletionStage<Message<O>> method(Message<I> msg)
- *
- *
- *

Manual

- *

None, Manual, Pre-Processing

+ * CompletionStage<Message<O>> method(Message<I> msg)
+ *
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Manual, Pre-Processing + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * CompletionStage<O> method(I payload)
- *
- *
- *

Post-Processing

- *

None, Pre-Processing, Post-Processing (when - * the message wrapping the produced payload is acknowledged)

+ * CompletionStage<O> method(I payload)
+ *
+ * + *
+ * + *

+ * Post-Processing + *

+ * + * + *

+ * None, Pre-Processing, Post-Processing (when the message wrapping the produced payload is acknowledged) + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * Publisher<Message<O>> method(Publisher<Message<I>> pub)
- *
- *
- *

Manual

- *

None, Manual, Pre-Processing

+ * Publisher<Message<O>> method(Publisher<Message<I>> pub)
+ *
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Manual, Pre-Processing + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * PublisherBuilder<Message<O>> method(PublisherBuilder<Message<I>> pub)
- *
- *
- *

Manual

- *

None, Manual, Pre-Processing

+ * PublisherBuilder<Message<O>> method(PublisherBuilder<Message<I>> pub)
+ *
+ * + *
+ * + *

+ * Manual + *

+ * + * + *

+ * None, Manual, Pre-Processing + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * Publisher<O> method(Publisher<I> pub)
- *
- *
- *

Pre-Processing

- *

None, Pre-Processing

+ * Publisher<O> method(Publisher<I> pub)
+ *
+ * + *
+ * + *

+ * Pre-Processing + *

+ * + * + *

+ * None, Pre-Processing + *

+ * * * - *
- *
- *
@Incoming("in")
+ * 
+ * + *
+ * @Incoming("in")
  * @Outgoing("out")
- * PublisherBuilder<O> method(PublisherBuilder<I> pub)
- *
- *
- *

Pre-Processing

- *

None, Pre-Processing

+ * PublisherBuilder<O> method(PublisherBuilder<I> pub)
+ *
+ * + *
+ * + *

+ * Pre-Processing + *

+ * + * + *

+ * None, Pre-Processing + *

+ * * * * @@ -325,40 +569,38 @@ @Retention(RetentionPolicy.RUNTIME) public @interface Acknowledgment { - enum Strategy { + enum Strategy { - /** - * Acknowledgment managed by the user code. No automatic acknowledgment is performed. This strategy is only - * supported by methods consuming {@link Message} instances. - */ - MANUAL, + /** + * Acknowledgment managed by the user code. No automatic acknowledgment is performed. This strategy is only + * supported by methods consuming {@link Message} instances. + */ + MANUAL, - /** - * Acknowledgment performed automatically before the processing of the message by the user code. - */ - PRE_PROCESSING, + /** + * Acknowledgment performed automatically before the processing of the message by the user code. + */ + PRE_PROCESSING, - /** - * Acknowledgment performed automatically once the message has been processed. - * When {@code POST_PROCESSING} is used, the incoming message is acknowledged when the produced message is - * acknowledged. - * - * Notice that this mode is not supported for all signatures. When supported, it's the default policy. - * - */ - POST_PROCESSING, + /** + * Acknowledgment performed automatically once the message has been processed. When {@code POST_PROCESSING} is + * used, the incoming message is acknowledged when the produced message is acknowledged. + * + * Notice that this mode is not supported for all signatures. When supported, it's the default policy. + * + */ + POST_PROCESSING, - /** - * No acknowledgment is performed, neither implicitly or explicitly. - * It means that the incoming messages are going to be acknowledged in a different location or using a different - * mechanism. - */ - NONE - } + /** + * No acknowledgment is performed, neither implicitly or explicitly. It means that the incoming messages are + * going to be acknowledged in a different location or using a different mechanism. + */ + NONE + } /** * @return the acknowledgement policy. */ - Strategy value(); + Strategy value(); } diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Channel.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Channel.java index c96b7bd8..716675a2 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Channel.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Channel.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2020 Contributors to the Eclipse Foundation +/* + * Copyright (c) 2020, 2021 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -27,9 +27,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.enterprise.util.Nonbinding; -import javax.inject.Qualifier; - +import jakarta.enterprise.util.Nonbinding; +import jakarta.inject.Qualifier; /** * This qualifier indicates which channel should be injected / populated. @@ -46,7 +45,8 @@ *
  • PublisherBuilder<X> with X the payload type
  • * *

    - * When this qualifier is used on an {@link Emitter}, it indicates which channel will receive the emitted values / signals: + * When this qualifier is used on an {@link Emitter}, it indicates which channel will receive the emitted values / + * signals: * *

      * 
    @@ -56,18 +56,20 @@
      * emitter.send("a");
      * 
      * 
    - * A subscriber for the above channel must be found when the application starts. - * Otherwise, {@link javax.enterprise.inject.spi.DeploymentException} must be thrown. + * + * A subscriber for the above channel must be found when the application starts. Otherwise, + * {@link jakarta.enterprise.inject.spi.DeploymentException} must be thrown. */ @Qualifier @Retention(RetentionPolicy.RUNTIME) -@Target({ METHOD, CONSTRUCTOR, FIELD, PARAMETER }) +@Target({METHOD, CONSTRUCTOR, FIELD, PARAMETER}) public @interface Channel { /** * The name of the channel (indicated in the {@code @Outgoing} annotation. * - * @return the channel name, mandatory, non-{@code null} and non-blank. It must matches one of the available channels. + * @return the channel name, mandatory, non-{@code null} and non-blank. It must matches one of the available + * channels. */ @Nonbinding String value(); diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Emitter.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Emitter.java index b41129b6..7998d7ba 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Emitter.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Emitter.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2021 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -31,45 +31,50 @@ * Emitter<String> emitter; * *

    - * You can use an injected emitter to send either payloads or - * {@link org.eclipse.microprofile.reactive.messaging.Message Messages}. + * You can use an injected emitter to send either payloads or {@link org.eclipse.microprofile.reactive.messaging.Message + * Messages}. *

    - * The name of the channel (given in the {@link Channel Channel annotation}) - * indicates which channel is fed. It must match the name used in a method using - * {@link org.eclipse.microprofile.reactive.messaging.Incoming @Incoming} or an + * The name of the channel (given in the {@link Channel Channel annotation}) indicates which channel is fed. It must + * match the name used in a method using {@link org.eclipse.microprofile.reactive.messaging.Incoming @Incoming} or an * outgoing channel configured in the application configuration. *

    - * The {@link OnOverflow OnOverflow annotation} can be used to configure what to do if - * messages are sent using the `Emitter` when a downstream subscriber hasn't requested - * more messages. + * The {@link OnOverflow OnOverflow annotation} can be used to configure what to do if messages are sent using the + * `Emitter` when a downstream subscriber hasn't requested more messages. * - * @param type of payload + * @param + * type of payload */ public interface Emitter { /** * Sends a payload to the channel. *

    - * A {@link Message} object will be created to hold the payload and the returned {@code CompletionStage} will be completed once this - * {@code Message} is acknowledged. If the {@code Message} is never acknowledged, then the {@code CompletionStage} will never be completed. + * A {@link Message} object will be created to hold the payload and the returned {@code CompletionStage} will be + * completed once this {@code Message} is acknowledged. If the {@code Message} is never acknowledged, then the + * {@code CompletionStage} will never be completed. * - * @param msg the thing to send, must not be {@code null} + * @param msg + * the thing to send, must not be {@code null} * @return the {@code CompletionStage}, which will be completed when the message for this payload is acknowledged. * If the emitted message is nacked, the produced completion stage is completed exceptionally. - * @throws IllegalStateException if the channel has been cancelled or terminated or if an overflow strategy of - * {@link OnOverflow.Strategy#THROW_EXCEPTION THROW_EXCEPTION} or {@link OnOverflow.Strategy#BUFFER BUFFER} is - * configured and the emitter overflows. + * @throws IllegalStateException + * if the channel has been cancelled or terminated or if an overflow strategy of + * {@link OnOverflow.Strategy#THROW_EXCEPTION THROW_EXCEPTION} or {@link OnOverflow.Strategy#BUFFER + * BUFFER} is configured and the emitter overflows. */ CompletionStage send(T msg); /** * Sends a message to the channel. * - * @param the Message type - * @param msg the Message to send, must not be {@code null} - * @throws IllegalStateException if the channel has been cancelled or terminated or if an overflow strategy of - * {@link OnOverflow.Strategy#THROW_EXCEPTION THROW_EXCEPTION} or {@link OnOverflow.Strategy#BUFFER BUFFER} is - * configured and the emitter overflows. + * @param + * the Message type + * @param msg + * the Message to send, must not be {@code null} + * @throws IllegalStateException + * if the channel has been cancelled or terminated or if an overflow strategy of + * {@link OnOverflow.Strategy#THROW_EXCEPTION THROW_EXCEPTION} or {@link OnOverflow.Strategy#BUFFER + * BUFFER} is configured and the emitter overflows. */ > void send(M msg); @@ -81,7 +86,8 @@ public interface Emitter { /** * Sends a failure event to the channel. No more events will be sent afterward. * - * @param e the exception, must not be {@code null} + * @param e + * the exception, must not be {@code null} */ void error(Exception e); @@ -91,8 +97,8 @@ public interface Emitter { boolean isCancelled(); /** - * @return {@code true} if one or more subscribers request messages from the corresponding channel where the emitter connects to, - * return {@code false} otherwise. + * @return {@code true} if one or more subscribers request messages from the corresponding channel where the emitter + * connects to, return {@code false} otherwise. */ boolean hasRequests(); diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Incoming.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Incoming.java index b6f9a2be..ec487856 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Incoming.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Incoming.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -18,15 +18,14 @@ */ package org.eclipse.microprofile.reactive.messaging; - -import org.eclipse.microprofile.reactive.streams.operators.ProcessorBuilder; -import org.eclipse.microprofile.reactive.streams.operators.SubscriberBuilder; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.eclipse.microprofile.reactive.streams.operators.ProcessorBuilder; +import org.eclipse.microprofile.reactive.streams.operators.SubscriberBuilder; + /** * Used to signify a subscriber to incoming messages. *

    @@ -47,27 +46,26 @@ *

    * The type of the message accepted by the subscriber may be wrapped in {@link Message}, or a subclass of it. All * messaging providers must support {@code Message}, but messaging providers may also provide subclasses of - * {@code Message} in order to expose message transport specific features. Use of these sub classes will result in - * a non portable application. If the chosen messaging provider does not support the selected message wrapper, a - * deployment exception will be raised before the container is initialized. + * {@code Message} in order to expose message transport specific features. Use of these sub classes will result in a non + * portable application. If the chosen messaging provider does not support the selected message wrapper, a deployment + * exception will be raised before the container is initialized. *

    *

    * If the incoming message is wrapped in a {@code Message} wrapper, then it is the responsibility of the subscriber to - * acknowledge messages. This can either by done by invoking {@link Message#ack()} directly, or if using a method - * shape that has an output value (such as the processor shapes, or methods that return a value), and if the output - * value also is also wrapped in a {@code Message}, by passing the {@code ack} callback to the emitted {@code Message} - * so that the container can ack it. + * acknowledge messages. This can either by done by invoking {@link Message#ack()} directly, or if using a method shape + * that has an output value (such as the processor shapes, or methods that return a value), and if the output value also + * is also wrapped in a {@code Message}, by passing the {@code ack} callback to the emitted {@code Message} so that the + * container can ack it. *

    *

    * If the incoming message is not wrapped, then the container is responsible for automatically acknowledging messages. - * When the ack is done depends on the shape of the method - for subscriber shapes, it may either be done before or after - * passing a message to the subscriber (note that it doesn't matter which, since compliant Reactive Streams + * When the ack is done depends on the shape of the method - for subscriber shapes, it may either be done before or + * after passing a message to the subscriber (note that it doesn't matter which, since compliant Reactive Streams * implementations don't allow throwing exceptions directly from the subscriber). For processor shapes, it should be - * when the processor emits an element. In this case, it is assumed, and the application must ensure, that there is - * a 1:1 correlation of elements consumed and emitted by the processor, and that ordering is maintained. For shapes - * that return a {@code CompletionStage}, it should be when that completion stage is redeemed. For methods that - * accept a single parameter and then return void or a value, it should be done after the method is invoked - * successfully. + * when the processor emits an element. In this case, it is assumed, and the application must ensure, that there is a + * 1:1 correlation of elements consumed and emitted by the processor, and that ordering is maintained. For shapes that + * return a {@code CompletionStage}, it should be when that completion stage is redeemed. For methods that accept a + * single parameter and then return void or a value, it should be done after the method is invoked successfully. *

    *

    * If there is an output value, and it is wrapped, then it is the containers responsibility to invoke diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Message.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Message.java index c4f84cda..b1dd213e 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Message.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Message.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -30,15 +30,18 @@ * information to be passed to and from applications. *

    * - * @param The type of the message payload. + * @param + * The type of the message payload. */ public interface Message { /** * Create a message with the given payload. * - * @param payload The payload. - * @param The type of payload + * @param payload + * The payload. + * @param + * The type of payload * @return A message with the given payload, and a no-op ack function. */ static Message of(T payload) { @@ -48,9 +51,12 @@ static Message of(T payload) { /** * Create a message with the given payload and ack function. * - * @param payload The payload. - * @param ack The ack function, this will be invoked when the returned messages {@link #ack()} method is invoked. - * @param the type of payload + * @param payload + * The payload. + * @param ack + * The ack function, this will be invoked when the returned messages {@link #ack()} method is invoked. + * @param + * the type of payload * @return A message with the given payload and ack function. */ static Message of(T payload, Supplier> ack) { @@ -70,15 +76,19 @@ public CompletionStage ack() { /** * Create a message with the given payload, ack and nack functions. * - * @param payload The payload. - * @param ack The ack function, this will be invoked when the returned messages {@link #ack()} method is invoked. - * @param nack The negative-ack function, this will be invoked when the returned messages {@link #nack(Throwable)} - * method is invoked. - * @param the type of payload + * @param payload + * The payload. + * @param ack + * The ack function, this will be invoked when the returned messages {@link #ack()} method is invoked. + * @param nack + * The negative-ack function, this will be invoked when the returned messages {@link #nack(Throwable)} + * method is invoked. + * @param + * the type of payload * @return A message with the given payload, ack and nack functions. */ static Message of(T payload, - Supplier> ack, Function> nack) { + Supplier> ack, Function> nack) { return new Message() { @Override public T getPayload() { @@ -98,11 +108,13 @@ public Function> getNack() { } /** - * Creates a new instance of {@link Message} with the specified payload. - * The ack/nack functions are taken from the current {@link Message}. + * Creates a new instance of {@link Message} with the specified payload. The ack/nack functions are taken from the + * current {@link Message}. * - * @param payload the new payload. - * @param

    the type of the new payload + * @param payload + * the new payload. + * @param

    + * the type of the new payload * @return the new instance of {@link Message} */ default

    Message

    withPayload(P payload) { @@ -110,10 +122,11 @@ default

    Message

    withPayload(P payload) { } /** - * Creates a new instance of {@link Message} with the given acknowledgement supplier. - * The payload, and nack function are taken from the current {@link Message}. + * Creates a new instance of {@link Message} with the given acknowledgement supplier. The payload, and nack function + * are taken from the current {@link Message}. * - * @param ack the positive-acknowledgement function + * @param ack + * the positive-acknowledgement function * @return the new instance of {@link Message} */ default Message withAck(Supplier> ack) { @@ -121,10 +134,11 @@ default Message withAck(Supplier> ack) { } /** - * Creates a new instance of {@link Message} with the given negative-acknowledgement function. - * The payload and acknowledgment are taken from the current {@link Message}. + * Creates a new instance of {@link Message} with the given negative-acknowledgement function. The payload and + * acknowledgment are taken from the current {@link Message}. * - * @param nack the negative-acknowledgement function + * @param nack + * the negative-acknowledgement function * @return the new instance of {@link Message} */ default Message withNack(Function> nack) { @@ -140,7 +154,7 @@ default Message withNack(Function> nack) { * Acknowledge this message. * * @return a completion stage completed when the message is acknowledged. If the acknowledgement fails, the - * completion stage propagates the failure. + * completion stage propagates the failure. */ default CompletionStage ack() { return CompletableFuture.completedFuture(null); @@ -161,13 +175,13 @@ default Function> getNack() { } /** - * Acknowledge negatively this message. - * nack is used to indicate that the processing of a message failed with the reason passed as the - * parameter. + * Acknowledge negatively this message. nack is used to indicate that the processing of a message + * failed with the reason passed as the parameter. * - * @param reason the reason of the nack, must not be {@code null} - * @return a completion stage completed when the message is negative-acknowledgement has completed. If the - * negative acknowledgement fails, the completion stage propagates the failure. + * @param reason + * the reason of the nack, must not be {@code null} + * @return a completion stage completed when the message is negative-acknowledgement has completed. If the negative + * acknowledgement fails, the completion stage propagates the failure. */ default CompletionStage nack(Throwable reason) { if (reason == null) { @@ -176,27 +190,28 @@ default CompletionStage nack(Throwable reason) { Function> nack = getNack(); if (nack == null) { return CompletableFuture.completedFuture(null); - } - else { + } else { return nack.apply(reason); } } - /** * Returns an object of the specified type to allow access to the connector-specific {@link Message} implementation, * and other classes. For example, a Kafka connector could implement this method to allow unwrapping to a specific * Kafka message implementation, or to {@code ConsumerRecord} and {@code ProducerRecord}. If the {@link Message} * implementation does not support the target class, an {@link IllegalArgumentException} should be raised. * - * The default implementation tries to cast the current {@link Message} instance to the target class. - * When a connector provides its own {@link Message} implementation, it should override this method to support - * specific types. + * The default implementation tries to cast the current {@link Message} instance to the target class. When + * a connector provides its own {@link Message} implementation, it should override this method to support specific + * types. * - * @param unwrapType the class of the object to be returned, must not be {@code null} - * @param the target type + * @param unwrapType + * the class of the object to be returned, must not be {@code null} + * @param + * the target type * @return an instance of the specified class - * @throws IllegalArgumentException if the current {@link Message} instance does not support the call + * @throws IllegalArgumentException + * if the current {@link Message} instance does not support the call */ default C unwrap(Class unwrapType) { if (unwrapType == null) { @@ -204,12 +219,10 @@ default C unwrap(Class unwrapType) { } try { return unwrapType.cast(this); - } - catch (ClassCastException e) { + } catch (ClassCastException e) { throw new IllegalArgumentException("Cannot unwrap an instance of " + this.getClass().getName() - + " to " + unwrapType.getName(), e); + + " to " + unwrapType.getName(), e); } - } } diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/OnOverflow.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/OnOverflow.java index ec6af47f..30d3371c 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/OnOverflow.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/OnOverflow.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2020 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -27,7 +27,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; - /** * Configures the back pressure policy on an injected {@link Emitter}: * @@ -44,7 +43,7 @@ * When not used, a {@link OnOverflow.Strategy#BUFFER} strategy is used with a buffer limited to 128 elements. */ @Retention(RetentionPolicy.RUNTIME) -@Target({ METHOD, CONSTRUCTOR, FIELD, PARAMETER }) +@Target({METHOD, CONSTRUCTOR, FIELD, PARAMETER}) public @interface OnOverflow { /** @@ -52,26 +51,26 @@ */ enum Strategy { /** - * Buffers all values until the downstream consumes it. - * This creates a buffer with the size specified by {@link #bufferSize()} if present. - * Otherwise, the size will be the value of the config property + * Buffers all values until the downstream consumes it. This creates a buffer with the size + * specified by {@link #bufferSize()} if present. Otherwise, the size will be the value of the config property * mp.messaging.emitter.default-buffer-size. *

    * If the buffer is full, an {@link IllegalStateException} will be thrown by the {@code Emitter.send} method. */ BUFFER, - + /** - * Buffers all values until the downstream consumes it. - * This creates an unbounded buffer so the application may run out of memory if values are continually added faster than they are consumed. + * Buffers all values until the downstream consumes it. This creates an unbounded buffer so the + * application may run out of memory if values are continually added faster than they are consumed. */ UNBOUNDED_BUFFER, - + /** - * Causes an {@link IllegalStateException} to be thrown by the {@code Emitter.send} method if the downstream can't keep up. + * Causes an {@link IllegalStateException} to be thrown by the {@code Emitter.send} method if the downstream + * can't keep up. */ THROW_EXCEPTION, - + /** * Drops the most recent value if the downstream can't keep up. It means that new value emitted by the upstream * are ignored. @@ -79,8 +78,8 @@ enum Strategy { DROP, /** - * Sends an error signal to the downstream subscriber in the case where it can't keep up. - * This terminates the reactive stream so no more values will be published. + * Sends an error signal to the downstream subscriber in the case where it can't keep up. This terminates the + * reactive stream so no more values will be published. */ FAIL, @@ -102,9 +101,9 @@ enum Strategy { Strategy value(); /** - * @return the size of the buffer when {@link Strategy#BUFFER} is used. If not set and if the {@link Strategy#BUFFER} - * strategy is used, the buffer size will be defaulted to the value of the config property - * mp.messaging.emitter.defult-buffer-size. + * @return the size of the buffer when {@link Strategy#BUFFER} is used. If not set and if the + * {@link Strategy#BUFFER} strategy is used, the buffer size will be defaulted to the value of the config + * property mp.messaging.emitter.defult-buffer-size. */ long bufferSize() default 0; diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Outgoing.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Outgoing.java index 681c4903..2cedbec3 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Outgoing.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/Outgoing.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -18,15 +18,14 @@ */ package org.eclipse.microprofile.reactive.messaging; - -import org.eclipse.microprofile.reactive.streams.operators.ProcessorBuilder; -import org.eclipse.microprofile.reactive.streams.operators.PublisherBuilder; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.eclipse.microprofile.reactive.streams.operators.ProcessorBuilder; +import org.eclipse.microprofile.reactive.streams.operators.PublisherBuilder; + /** * Used to signify a publisher of outgoing messages. *

    @@ -51,16 +50,15 @@ *

    * The type of the message emitted by the publisher may be wrapped in {@link Message}, or a subclass of it. All * messaging providers must support {@code Message}, but messaging providers may also provide subclasses of - * {@code Message} in order to expose message transport specific features. Use of these sub classes will result in - * a non portable application. If the chosen messaging provider does not support the selected message wrapper, a - * deployment exception will be raised before the container is initialized. + * {@code Message} in order to expose message transport specific features. Use of these sub classes will result in a non + * portable application. If the chosen messaging provider does not support the selected message wrapper, a deployment + * exception will be raised before the container is initialized. *

    *

    * If the outing message is wrapped in a {@code Message} wrapper, then it is the responsibility of the container to * acknowledge messages, by invoking the {@link Message#ack()} method on each message it receives. Containers must be * careful to invoke these messages in order, one at a time, unless configured not to through a container specific - * mechanism. Containers may provide the ability to configure batching of acks, or only acking one in every n - * messages. + * mechanism. Containers may provide the ability to configure batching of acks, or only acking one in every n messages. *

    * * @see org.eclipse.microprofile.reactive.messaging diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/package-info.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/package-info.java index bac23a20..3f0a9eb7 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/package-info.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2018, 2020 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -16,6 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /** * The MicroProfile Reactive Messaging API. *

    @@ -28,10 +29,11 @@ * repeat failures. *

    * The application should use Reactive Streams to provide the message stream handlers. Generally, use of - * {@link org.eclipse.microprofile.reactive.streams} builders should be used in preference to either Reactive Streams + * {@code org.eclipse.microprofile.reactive.streams} builders should be used in preference to either Reactive Streams * interfaces directly, or container specific implementations of streams. *

    * Here is an example use of this API: + * *

      *   @ApplicationScoped
      *   public class EmailPublisher {
    @@ -53,5 +55,5 @@
      * 
    */ -@org.osgi.annotation.versioning.Version("1.1") +@org.osgi.annotation.versioning.Version("2.0") package org.eclipse.microprofile.reactive.messaging; diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/Connector.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/Connector.java index 20c48c98..01836436 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/Connector.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/Connector.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation +/* + * Copyright (c) 2018, 2021 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -18,22 +18,22 @@ */ package org.eclipse.microprofile.reactive.messaging.spi; - -import javax.inject.Qualifier; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import jakarta.inject.Qualifier; + /** * Qualifier used on connector implementations to indicate the associated underlying transport. *

    - * The value indicates the name associated with the bean implementing either - * {@link IncomingConnectorFactory} or {@link OutgoingConnectorFactory} or both. + * The value indicates the name associated with the bean implementing either {@link IncomingConnectorFactory} or + * {@link OutgoingConnectorFactory} or both. *

    * Note that the given name is a user-facing interface used in the configuration. */ @@ -43,9 +43,9 @@ public @interface Connector { /** - * @return The name of the connector associated with the bean implementing {@link IncomingConnectorFactory} - * or {@link OutgoingConnectorFactory}. Must not be {@code null}. Returning {@code null} will cause a deployment - * failure. + * @return The name of the connector associated with the bean implementing {@link IncomingConnectorFactory} or + * {@link OutgoingConnectorFactory}. Must not be {@code null}. Returning {@code null} will cause a + * deployment failure. */ String value(); diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorAttribute.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorAttribute.java index 35fadec4..f5f60434 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorAttribute.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorAttribute.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2021 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -18,33 +18,30 @@ */ package org.eclipse.microprofile.reactive.messaging.spi; +import static java.lang.annotation.ElementType.TYPE; + import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.TYPE; - /** - * Connector implementor can use this annotation to document attributes supported by their connector. - * This allows tools (IDE, annotation processors...) to extract that data to provide code completion or documentation - * generation. + * Connector implementor can use this annotation to document attributes supported by their connector. This allows tools + * (IDE, annotation processors...) to extract that data to provide code completion or documentation generation. * - * Each attribute is represented by an instance of {@code ConnectorAttribute}. - * For example: + * Each attribute is represented by an instance of {@link ConnectorAttribute}. For example: * *

    - * {@code
    - *  @ConnectorAttribute(name = "bootstrap.servers", alias = "kafka.bootstrap.servers", type = "string",
    + *  @ConnectorAttribute(name = "bootstrap.servers", alias = "kafka.bootstrap.servers", type = "string",
      *      defaultValue = "localhost:9092", direction = Direction.INCOMING_AND_OUTGOING,
      *      description = "...")
    - *  @ConnectorAttribute(name = "topic", type = "string", direction = Direction.INCOMING_AND_OUTGOING,
    + *  @ConnectorAttribute(name = "topic", type = "string", direction = Direction.INCOMING_AND_OUTGOING,
      *      description = "...")
    - *  @ConnectorAttribute(name = "value-deserialization-failure-handler", type = "string", direction = Direction.INCOMING,
    + *  @ConnectorAttribute(name = "value-deserialization-failure-handler", type = "string", direction = Direction.INCOMING,
      *      description = "...")
    - *  @ConnectorAttribute(name = "merge", direction = OUTGOING, type = "boolean", defaultValue = "false",
    + *  @ConnectorAttribute(name = "merge", direction = OUTGOING, type = "boolean", defaultValue = "false",
      *      description = "...")
    - *  @Connector("my-connector")
    + *  @Connector("my-connector")
      *  public class MyConnector implements  IncomingConnectorFactory, OutgoingConnectorFactory {
      *    ...
      * }
    diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorAttributes.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorAttributes.java
    index 6e0de38c..fdeb21a9 100644
    --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorAttributes.java
    +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorAttributes.java
    @@ -1,4 +1,4 @@
    -/**
    +/*
      * Copyright (c) 2021 Contributors to the Eclipse Foundation
      *
      * See the NOTICE file(s) distributed with this work for additional
    @@ -26,8 +26,8 @@
     /**
      * This class is used to allow multiple {@link ConnectorAttribute} declarations.
      *
    - * This class should not be used directly. Instead, multiple {@link ConnectorAttribute} should be used on the
    - * class annotated with {@link Connector}.
    + * This class should not be used directly. Instead, multiple {@link ConnectorAttribute} should be used on the class
    + * annotated with {@link Connector}.
      */
     @Retention(RetentionPolicy.CLASS)
     @Target(ElementType.TYPE)
    diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorFactory.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorFactory.java
    index 6c4a37a5..62e31209 100644
    --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorFactory.java
    +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorFactory.java
    @@ -1,4 +1,4 @@
    -/**
    +/*
      * Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation
      *
      * See the NOTICE file(s) distributed with this work for additional
    @@ -37,8 +37,8 @@ public interface ConnectorFactory {
          * The {@code connector} attribute name.
          *
          * This attribute is part of the {@link org.eclipse.microprofile.config.Config} passed to the
    -     * {@link IncomingConnectorFactory} and {@link OutgoingConnectorFactory} when a new channel is created. It
    -     * indicates the name of the connector.
    +     * {@link IncomingConnectorFactory} and {@link OutgoingConnectorFactory} when a new channel is created. It indicates
    +     * the name of the connector.
          *
          * Note that each channel configured from the MicroProfile Config support must provide this attribute to indicate
          * which connector is used. It must match the name given to the {@link Connector} qualifier.
    diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorLiteral.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorLiteral.java
    index 954e3d45..2e7e15b5 100644
    --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorLiteral.java
    +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/ConnectorLiteral.java
    @@ -1,5 +1,5 @@
    -/**
    - * Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation
    +/*
    + * Copyright (c) 2018, 2021 Contributors to the Eclipse Foundation
      *
      * See the NOTICE file(s) distributed with this work for additional
      * information regarding copyright ownership.
    @@ -18,7 +18,7 @@
      */
     package org.eclipse.microprofile.reactive.messaging.spi;
     
    -import javax.enterprise.util.AnnotationLiteral;
    +import jakarta.enterprise.util.AnnotationLiteral;
     
     /**
      * Supports inline instantiation of the {@link Connector} qualifier.
    @@ -32,7 +32,8 @@ public final class ConnectorLiteral extends AnnotationLiteral impleme
         /**
          * Creates a new instance of {@link ConnectorLiteral}.
          *
    -     * @param value the name of the connector, must not be {@code null}, must not be {@code blank}
    +     * @param value
    +     *            the name of the connector, must not be {@code null}, must not be {@code blank}
          * @return the {@link ConnectorLiteral} instance.
          */
         public static Connector of(String value) {
    @@ -40,10 +41,11 @@ public static Connector of(String value) {
         }
     
         /**
    -     * Creates a new instance of {@link ConnectorLiteral}.
    -     * Users should use the {@link #of(String)} method to create instances.
    +     * Creates a new instance of {@link ConnectorLiteral}. Users should use the {@link #of(String)} method to create
    +     * instances.
          *
    -     * @param value the value.
    +     * @param value
    +     *            the value.
          */
         private ConnectorLiteral(String value) {
             this.value = value;
    @@ -56,4 +58,3 @@ public String value() {
             return value;
         }
     }
    -
    diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/IncomingConnectorFactory.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/IncomingConnectorFactory.java
    index d1964519..06198d1c 100644
    --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/IncomingConnectorFactory.java
    +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/IncomingConnectorFactory.java
    @@ -1,5 +1,5 @@
    -/**
    - * Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation
    +/*
    + * Copyright (c) 2018, 2021 Contributors to the Eclipse Foundation
      *
      * See the NOTICE file(s) distributed with this work for additional
      * information regarding copyright ownership.
    @@ -18,12 +18,12 @@
      */
     package org.eclipse.microprofile.reactive.messaging.spi;
     
    +import java.util.NoSuchElementException;
    +
     import org.eclipse.microprofile.config.Config;
     import org.eclipse.microprofile.reactive.messaging.Message;
     import org.eclipse.microprofile.reactive.streams.operators.PublisherBuilder;
     
    -import java.util.NoSuchElementException;
    -
     /**
      * SPI used to implement a connector managing a source of messages for a specific transport. For example, to
      * handle the consumption of records from Kafka, the reactive messaging extension would need to implement a {@code bean}
    @@ -31,8 +31,8 @@
      * transport (so Kafka in this case). These channels are connected to methods annotated with
      * {@link org.eclipse.microprofile.reactive.messaging.Incoming}.
      * 

    - * The factory is called to create a {@code channel} for each configured transport. The configuration is done using - * MicroProfile Config. The following snippet gives an example for a hypothetical Kafka connector: + * The factory is called to create a {@code channel} for each configured transport. The configuration is done + * using MicroProfile Config. The following snippet gives an example for a hypothetical Kafka connector: * *

      * mp.messaging.incoming.my-channel.topic=my-topic
    @@ -40,13 +40,12 @@
      * ...
      * 
    *

    - * The configuration keys are structured as follows: {@code mp.messaging.[incoming|outgoing].channel-name.attribute} or - * {@code mp.messaging.[connector].connector-name.attribute}. - * Channel names are not expected to contain {@code .} so the first occurrence of a {@code .} in the {@code channel-name} - * portion of a property terminates the channel name and precedes the attribute name. - * For connector attributes, the longest string, inclusive of {@code .}s, that matches a loadable - * connector is used as a {@code connector-name}. The remainder, after a {@code .} separator, is the attribute name. - * Configuration keys that begin {@code mp.messaging.outgoing}} are not used for {@link IncomingConnectorFactory} + * The configuration keys are structured as follows: {@code mp.messaging.[incoming|outgoing].channel-name.attribute} or + * {@code mp.messaging.[connector].connector-name.attribute}. Channel names are not expected to contain {@code .} so the + * first occurrence of a {@code .} in the {@code channel-name} portion of a property terminates the channel name and + * precedes the attribute name. For connector attributes, the longest string, inclusive of {@code .}s, that matches a + * loadable connector is used as a {@code connector-name}. The remainder, after a {@code .} separator, is the attribute + * name. Configuration keys that begin {@code mp.messaging.outgoing}} are not used for {@link IncomingConnectorFactory} * configuration. *

    * The portion of the key that precedes the {@code attribute} acts as a property prefix that has a common structure @@ -59,26 +58,27 @@ *

      * @Incoming("my-channel")
      * public void consume(String s) {
    - *      // ...
    + *     // ...
      * }
      * 
    *

    * The set of attributes depend on the connector and transport layer (for example, bootstrap.servers is Kafka specific). - * The connector attribute indicates the name of the connector. It will be matched to - * the value returned by the {@link Connector} qualifier used on the relevant {@link IncomingConnectorFactory} bean implementation. - * This is how a reactive messaging implementation looks for the specific {@link IncomingConnectorFactory} required for - * a channel. Any {@code mp.messaging.connector} attributes for the channel's connector are also included in the set - * of relevant attributes. Where an attribute is present for both a channel and its connector the value of the channel - * specific attribute will take precedence. + * The connector attribute indicates the name of the connector. It will be matched to the value returned by the + * {@link Connector} qualifier used on the relevant {@link IncomingConnectorFactory} bean implementation. This is how a + * reactive messaging implementation looks for the specific {@link IncomingConnectorFactory} required for a channel. Any + * {@code mp.messaging.connector} attributes for the channel's connector are also included in the set of relevant + * attributes. Where an attribute is present for both a channel and its connector the value of the channel specific + * attribute will take precedence. * * In the previous configuration, the reactive messaging implementation would need to find the - * {@link IncomingConnectorFactory} qualified using the {@link Connector} qualifier with the value - * {@code acme.kafka} class to create the {@code my-channel} channel. Note that if the - * connector cannot be found, the deployment must be failed with a {@link javax.enterprise.inject.spi.DeploymentException}. + * {@link IncomingConnectorFactory} qualified using the {@link Connector} qualifier with the value {@code acme.kafka} + * class to create the {@code my-channel} channel. Note that if the connector cannot be found, the deployment must be + * failed with a {@link jakarta.enterprise.inject.spi.DeploymentException}. *

    - * The {@link #getPublisherBuilder(Config)} is called for every channel that needs to be created. The {@link Config} object - * passed to the method contains a subset of the global configuration, and with the prefixes removed. So for the previous - * configuration, it would be: + * The {@link #getPublisherBuilder(Config)} is called for every channel that needs to be created. The {@link Config} + * object passed to the method contains a subset of the global configuration, and with the prefixes removed. So for the + * previous configuration, it would be: + * *

      * bootstrap.servers = localhost:9092
      * topic = my-topic
    @@ -93,7 +93,7 @@
      * 

    * If the configuration is invalid, the {@link #getPublisherBuilder(Config)} method must throw an * {@link IllegalArgumentException}, caught by the reactive messaging implementation and failing the deployment by - * throwing a {@link javax.enterprise.inject.spi.DeploymentException} wrapping the exception. + * throwing a {@link jakarta.enterprise.inject.spi.DeploymentException} wrapping the exception. *

    * Note that a Reactive Messaging implementation must support the configuration format described here. Implementations * are free to provide additional support for other approaches. @@ -101,19 +101,22 @@ public interface IncomingConnectorFactory extends ConnectorFactory { /** - * Creates a channel for the given configuration. The channel's configuration is associated with a - * specific {@code connector}, using the {@link Connector} qualifier's parameter indicating a key to - * which {@link IncomingConnectorFactory} to use. + * Creates a channel for the given configuration. The channel's configuration is associated with a specific + * {@code connector}, using the {@link Connector} qualifier's parameter indicating a key to which + * {@link IncomingConnectorFactory} to use. * *

    * Note that the connection to the transport or broker is generally postponed until the * subscription occurs. * - * @param config the configuration, must not be {@code null}, must contain the {@link #CHANNEL_NAME_ATTRIBUTE} - * attribute. + * @param config + * the configuration, must not be {@code null}, must contain the {@link #CHANNEL_NAME_ATTRIBUTE} + * attribute. * @return the created {@link PublisherBuilder}, will not be {@code null}. - * @throws IllegalArgumentException if the configuration is invalid. - * @throws NoSuchElementException if the configuration does not contain an expected attribute. + * @throws IllegalArgumentException + * if the configuration is invalid. + * @throws NoSuchElementException + * if the configuration does not contain an expected attribute. */ PublisherBuilder> getPublisherBuilder(Config config); diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/OutgoingConnectorFactory.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/OutgoingConnectorFactory.java index c258ad2e..161fcca8 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/OutgoingConnectorFactory.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/OutgoingConnectorFactory.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -18,13 +18,12 @@ */ package org.eclipse.microprofile.reactive.messaging.spi; +import java.util.NoSuchElementException; + import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.reactive.messaging.Message; import org.eclipse.microprofile.reactive.streams.operators.SubscriberBuilder; - -import java.util.NoSuchElementException; - /** * SPI used to implement a connector managing a sink of messages for a specific transport. For example, to * handle dispatch messages to Kafka, the reactive messaging extension would implement a {@code bean} implementing this @@ -32,8 +31,8 @@ * (so Kafka in this example). These streams are connected to methods annotated with * {@link org.eclipse.microprofile.reactive.messaging.Outgoing}. *

    - * The factory is called to create a {@code subscriber} for each configured transport. The configuration is done - * using MicroProfile Config. The following snippet gives an example for a hypothetical Kafka connector: + * The factory is called to create a {@code subscriber} for each configured transport. The configuration is + * done using MicroProfile Config. The following snippet gives an example for a hypothetical Kafka connector: * *

      * mp.messaging.outgoing.my-channel.connector=acme.kafka
    @@ -43,13 +42,12 @@
      * 
    *

    * The configuration keys are structured as follows: {@code mp.messaging.[incoming|outgoing].channel-name.attribute} or - * {@code mp.messaging.[connector].connector-name.attribute}. - * Channel names are not expected to contain {@code .} so the first occurrence of a {@code .} in the channel-name portion - * of a property terminates the channel name and precedes the attribute name. - * For connector attributes, the longest string, inclusive of {@code .}s, that matches a loadable - * connector is used as a {@code connector-name}. The remainder, after a {@code .} separator, is the attribute name. - * Configuration keys that begin - * {@code mp.messaging.incoming} are not used for {@link OutgoingConnectorFactory} configuration. + * {@code mp.messaging.[connector].connector-name.attribute}. Channel names are not expected to contain {@code .} so the + * first occurrence of a {@code .} in the channel-name portion of a property terminates the channel name and precedes + * the attribute name. For connector attributes, the longest string, inclusive of {@code .}s, that matches a loadable + * connector is used as a {@code connector-name}. The remainder, after a {@code .} separator, is the attribute name. + * Configuration keys that begin {@code mp.messaging.incoming} are not used for {@link OutgoingConnectorFactory} + * configuration. *

    * The {@code channel-name} segment in the configuration key corresponds to the name of the channel used in the * {@code Outgoing} annotation: @@ -57,27 +55,25 @@ *

      * @Outgoing("my-channel")
      * public CompletionStage<String> produce(String s) {
    - *      // ...
    + *     // ...
      * }
      * 
    *

    * The set of attributes depend on the connector and transport layer (For example, bootstrap.servers is Kafka specific). - * The {@code connector} attribute indicates the name of the connector. - * It will be matched to the value returned by the {@link Connector} qualifier - * used on the relevant {@link OutgoingConnectorFactory} bean implementation. - * This is how a reactive messaging implementation looks for the specific {@link OutgoingConnectorFactory} required for - * a channel. - * Any {@code mp.messaging.connector} attributes for the channel's connector are also included in the set - * of relevant attributes. Where an attribute is present for both a channel and its connector the value of the channel - * specific attribute will take precedence. - * In the previous configuration, the reactive messaging implementation would need to find the - * {@link OutgoingConnectorFactory} implementation qualified with the {@link Connector} qualifier with the value - * {@code acme.kafka} to create the {@code my-channel} subscriber. Note that if - * the connector cannot be found, the deployment must be failed with a {@link javax.enterprise.inject.spi.DeploymentException}. + * The {@code connector} attribute indicates the name of the connector. It will be matched to the value returned by the + * {@link Connector} qualifier used on the relevant {@link OutgoingConnectorFactory} bean implementation. This is how a + * reactive messaging implementation looks for the specific {@link OutgoingConnectorFactory} required for a channel. Any + * {@code mp.messaging.connector} attributes for the channel's connector are also included in the set of relevant + * attributes. Where an attribute is present for both a channel and its connector the value of the channel specific + * attribute will take precedence. In the previous configuration, the reactive messaging implementation would need to + * find the {@link OutgoingConnectorFactory} implementation qualified with the {@link Connector} qualifier with the + * value {@code acme.kafka} to create the {@code my-channel} subscriber. Note that if the connector cannot be + * found, the deployment must be failed with a {@link jakarta.enterprise.inject.spi.DeploymentException}. *

    * The {@link #getSubscriberBuilder(Config)} is called for every channel that needs to be created. The - * {@link Config} object passed to the method contains a subset of the global configuration, and with the prefixes removed. - * So for the previous configuration, it would be: + * {@link Config} object passed to the method contains a subset of the global configuration, and with the prefixes + * removed. So for the previous configuration, it would be: + * *

      * bootstrap.servers = localhost:9092
      * topic = my-topic
    @@ -96,18 +92,20 @@
     public interface OutgoingConnectorFactory extends ConnectorFactory {
     
         /**
    -     * Creates a channel for the given configuration. The channel's configuration is associated with a
    -     * specific {@code connector}, using the {@link Connector} qualifier's parameter indicating a key to
    -     * which {@link org.eclipse.microprofile.reactive.messaging.Outgoing} to use.
    +     * Creates a channel for the given configuration. The channel's configuration is associated with a specific
    +     * {@code connector}, using the {@link Connector} qualifier's parameter indicating a key to which
    +     * {@link org.eclipse.microprofile.reactive.messaging.Outgoing} to use.
          * 

    * Note that the connection to the transport or broker is generally postponed until the * subscription. * - * @param config the configuration, never {@code null}, must contain the {@link #CHANNEL_NAME_ATTRIBUTE} - * attribute. + * @param config + * the configuration, never {@code null}, must contain the {@link #CHANNEL_NAME_ATTRIBUTE} attribute. * @return the created {@link SubscriberBuilder}, must not be {@code null}. - * @throws IllegalArgumentException if the configuration is invalid. - * @throws NoSuchElementException if the configuration does not contain an expected attribute. + * @throws IllegalArgumentException + * if the configuration is invalid. + * @throws NoSuchElementException + * if the configuration does not contain an expected attribute. */ SubscriberBuilder, Void> getSubscriberBuilder(Config config); diff --git a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/package-info.java b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/package-info.java index bcf035e9..690ef60d 100644 --- a/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/reactive/messaging/spi/package-info.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -20,24 +20,24 @@ /** * The MicroProfile Reactive Messaging API Connector SPI *

    - * This package provides the SPI to implement {@code connectors}. A {@code connector} can be seen as a Reactive Messaging - * plug-in to support a specific messaging technology. For example, you can have a Kafka connector to deal with Kafka, - * an AMQP connector to interact with AMQP brokers and routers and so on. Connector implementation should be + * This package provides the SPI to implement {@code connectors}. A {@code connector} can be seen as a Reactive + * Messaging plug-in to support a specific messaging technology. For example, you can have a Kafka connector to deal + * with Kafka, an AMQP connector to interact with AMQP brokers and routers and so on. Connector implementation should be * agnostic to the Reactive Messaging implementation. * * A connector can be seen as: *

      - *
    • a source of messages - it retrieves messages and injects them into the Reactive Messaging application. To - * manage this direction, the connector implementation must implement the - * {@link org.eclipse.microprofile.reactive.messaging.spi.IncomingConnectorFactory} interface.
    • - *
    • a sink of messages - it forwards messages emitted by the Reactive Messaging application to the managed - * technology. To achieve this, the connector implementation must implement the - * {@link org.eclipse.microprofile.reactive.messaging.spi.OutgoingConnectorFactory} interface.
    • + *
    • a source of messages - it retrieves messages and injects them into the Reactive Messaging application. To manage + * this direction, the connector implementation must implement the + * {@link org.eclipse.microprofile.reactive.messaging.spi.IncomingConnectorFactory} interface.
    • + *
    • a sink of messages - it forwards messages emitted by the Reactive Messaging application to the managed + * technology. To achieve this, the connector implementation must implement the + * {@link org.eclipse.microprofile.reactive.messaging.spi.OutgoingConnectorFactory} interface.
    • *
    * - * Connectors are implemented as CDI beans and identified using the + * Connectors are implemented as CDI beans and identified using the * {@link org.eclipse.microprofile.reactive.messaging.spi.Connector} qualifier. Connectors receive the channel - * configuration matching their {@link Connector} name. + * configuration matching their {@link org.eclipse.microprofile.reactive.messaging.spi.Connector} name. */ -@org.osgi.annotation.versioning.Version("1.1") +@org.osgi.annotation.versioning.Version("2.0") package org.eclipse.microprofile.reactive.messaging.spi; diff --git a/api/src/main/javadoc/licenses/Draft/license.html b/api/src/main/javadoc/licenses/Draft/license.html deleted file mode 100644 index 67e36b97..00000000 --- a/api/src/main/javadoc/licenses/Draft/license.html +++ /dev/null @@ -1,47 +0,0 @@ - - - -Apache License - Version 2 - - -

    Apache License - Version 2

    -

    -Copyright (c) ${inceptionYear}-${currentYear} Contributors to the Eclipse Foundation -

    -

    -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -

    -

    - - http://www.apache.org/licenses/LICENSE-2.0 -

    -

    -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -

    - - \ No newline at end of file diff --git a/api/src/main/javadoc/licenses/Final/license.html b/api/src/main/javadoc/licenses/Final/license.html deleted file mode 100644 index 6b1e84fe..00000000 --- a/api/src/main/javadoc/licenses/Final/license.html +++ /dev/null @@ -1,92 +0,0 @@ - - - -Eclipse Foundation Specification License - v1.0 - - -

    Eclipse Foundation Specification License - v1.0

    -

    By using and/or copying this document, or the Eclipse Foundation - document from which this statement is linked, you (the licensee) agree - that you have read, understood, and will comply with the following - terms and conditions:

    - -

    Permission to copy, and distribute the contents of this document, or - the Eclipse Foundation document from which this statement is linked, in - any medium for any purpose and without fee or royalty is hereby - granted, provided that you include the following on ALL copies of the - document, or portions thereof, that you use:

    - -
      -
    • link or URL to the original Eclipse Foundation document.
    • -
    • All existing copyright notices, or if one does not exist, a notice - (hypertext is preferred, but a textual representation is permitted) - of the form: "Copyright © [$date-of-document] - “Eclipse Foundation, Inc. <<url to this license>> - " -
    • -
    - -

    Inclusion of the full text of this NOTICE must be provided. We - request that authorship attribution be provided in any software, - documents, or other items or products that you create pursuant to the - implementation of the contents of this document, or any portion - thereof.

    - -

    No right to create modifications or derivatives of Eclipse Foundation - documents is granted pursuant to this license, except anyone may - prepare and distribute derivative works and portions of this document - in software that implements the specification, in supporting materials - accompanying such software, and in documentation of such software, - PROVIDED that all such works include the notice below. HOWEVER, the - publication of derivative works of this document for use as a technical - specification is expressly prohibited.

    - -

    The notice is:

    - -

    "Copyright © [$date-of-document] Eclipse Foundation. This software or - document includes material copied from or derived from [title and URI - of the Eclipse Foundation specification document]."

    - -

    Disclaimers

    - -

    THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT - HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR - WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, - WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE - SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS - WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR - OTHER RIGHTS.

    - -

    THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE - FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT - OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE - CONTENTS THEREOF.

    - -

    The name and trademarks of the copyright holders or the Eclipse - Foundation may NOT be used in advertising or publicity pertaining to - this document or its contents without specific, written prior - permission. Title to copyright in this document will at all times - remain with copyright holders.

    - - - diff --git a/tck/src/main/licenses/Draft/LICENSE b/api/src/main/resources/LICENSE similarity index 99% rename from tck/src/main/licenses/Draft/LICENSE rename to api/src/main/resources/LICENSE index 8dada3ed..261eeb9e 100644 --- a/tck/src/main/licenses/Draft/LICENSE +++ b/api/src/main/resources/LICENSE @@ -178,7 +178,7 @@ APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" + boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api/src/main/resources/NOTICE b/api/src/main/resources/NOTICE new file mode 100644 index 00000000..8649eb24 --- /dev/null +++ b/api/src/main/resources/NOTICE @@ -0,0 +1,16 @@ +========================================================================= +== NOTICE file corresponding to section 4(d) of the Apache License, == +== Version 2.0, in this case for Microprofile Reactive Streams == +========================================================================= + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +SPDXVersion: SPDX-2.1 +PackageName: Eclipse Microprofile +PackageHomePage: http://www.eclipse.org/microprofile +PackageLicenseDeclared: Apache-2.0 + +PackageCopyrightText: +James Roper james@jazzy.id.au + diff --git a/approach.asciidoc b/approach.asciidoc index 0d10a237..7a0b25cd 100644 --- a/approach.asciidoc +++ b/approach.asciidoc @@ -1,5 +1,5 @@ // -// Copyright (c) 2018, 2019 Contributors to the Eclipse Foundation +// Copyright (c) 2018, 2021 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional // information regarding copyright ownership. @@ -58,7 +58,7 @@ Just considering the above API, there are a number of problems with this: * Any monitoring solutions that want to trace the flow of control through this API need to be explicitly aware of the API and what it does, so they can explicitly instrument it to carry correlation identifiers. Otherwise, explicit propagation of monitoring structures is required. -And that’s just the problems with one possible trivial API for asynchronous programming. In order to safely provide asynchronous programming features, high level, generally applicable patterns and components are needed to ensure compatibility, correct error propagation, backpressure propagation, thread safety, and clean code when using these features. Unfortunately, there already exist APIs in Java EE (such as JSR 356 WebSockets) that suffer from many of these problems (and I should point out that APIs like JSR 356 were created before standard solutions to these problems existed, so they shouldn’t be blamed for this). It’s important that going forward, we ensure that these same problems aren’t reintroduced. +And that’s just the problems with one possible trivial API for asynchronous programming. In order to safely provide asynchronous programming features, high level, generally applicable patterns and components are needed to ensure compatibility, correct error propagation, backpressure propagation, thread safety, and clean code when using these features. Unfortunately, there already exist APIs in Jakarta EE (such as JSR 356 WebSockets) that suffer from many of these problems (and I should point out that APIs like JSR 356 were created before standard solutions to these problems existed, so they shouldn’t be blamed for this). It’s important that going forward, we ensure that these same problems aren’t reintroduced. In general, there are two different types of operations that we want to do when doing asynchronous programming. The first is an operation that produces exactly one value or signals, or fails. Examples of such operations include: diff --git a/mp_checkstyle_rules.xml b/mp_checkstyle_rules.xml deleted file mode 100644 index debcf235..00000000 --- a/mp_checkstyle_rules.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml index dea3dbc5..03209d4b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ + 4.1.0 + 3.20.2 - 3.0.0 - ^_?[a-z][a-zA-Z0-9]*$ - - false - - false - 2.0 - 3.0 - 2.0 - - Draft 2018 - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt - repo - A business-friendly OSS license - - - - - Eclipse Foundation - http://www.eclipse.org/ - - GitHub https://github.com/eclipse/microprofile-reactive/issues @@ -91,388 +72,49 @@ scm:git:https://github.com/eclipse/microprofile-reactive-messaging.git scm:git:git@github.com:eclipse/microprofile-reactive-messaging.git https://github.com/eclipse/microprofile-reactive-messaging - 2.0.1-RC1 + 3.0-RC1 - - - ossrh - Sonatype OSSRH - Release Staging Area - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - ossrh - Sonatype OSSRH Snapshots - https://oss.sonatype.org/content/repositories/snapshots/ - true - - - api tck spec - - - repo.eclipse.org - Project Repository - Releases - https://repo.eclipse.org/content/groups/cbi/ - - - microprofile.repo.eclipse.org - Microprofile Project Repository - Releases - https://repo.eclipse.org/content/groups/microprofile/ - - - org.eclipse.microprofile.reactive-streams-operators microprofile-reactive-streams-operators-api - ${microprofile.reactive.streams.operators.version} + ${version.microprofile.reactive.streams.operators} org.eclipse.microprofile.config microprofile-config-api - ${microprofile-config-api.version} + ${version.microprofile.config} org.eclipse.microprofile.metrics microprofile-metrics-api - ${microprofile-metrics-api.version} + ${version.microprofile.metrics} org.osgi org.osgi.annotation.versioning - 1.1.0 - - - jakarta.enterprise - jakarta.enterprise.cdi-api - 2.0.2 - - - jakarta.el - jakarta.el-api - - - jakarta.ejb - jakarta.ejb-api - - - - - jakarta.annotation - jakarta.annotation-api - 1.3.5 - - - org.testng - testng - 7.4.0 + ${version.osgi.versioning} + provided org.awaitility awaitility - 4.1.0 - - - junit - junit - 4.13.2 + ${version.awaitability} org.assertj assertj-core - 3.20.2 - - - org.hamcrest - hamcrest-all - 1.3 - - - javax.json.bind - javax.json.bind-api - 1.0 - - - org.jboss.arquillian - arquillian-bom - 1.6.0.Final - import - pom + ${version.assertj} - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - true - true - false - ${arguments} -Prelease -Drevremark=${revremark} - - - - org.eclipse.cbi.maven.plugins - eclipse-jarsigner-plugin - 1.1.5 - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${checkstyle.version} - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.2 - - - org.apache.maven.plugins - maven-source-plugin - 3.1.0 - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.1.1 - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - org.codehaus.mojo - build-helper-maven-plugin - 3.0.0 - - - - - - org.eclipse.microprofile.maven - microprofile-maven-build-extension - 1.0 - true - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - verify-style - process-classes - - checkstyle-aggregate - - - - - UTF-8 - true - true - true - true - true - true - ${project.basedir}/mp_checkstyle_rules.xml - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - - timestamp-property - - - current.year - yyyy - en_US - - - - timestamp-property - - timestamp-property - - validate - - currentYear - yyyy - - - - - - - com.mycila - license-maven-plugin - 3.0 - - true -
    src/license/license.txt
    - - - COPYRIGHT_DATE - ${current.year} - (\d{4}, ?)?\d{4} - - - - Eclipse MicroProfile - - - DOUBLESLASH_STYLE - DOUBLESLASH_STYLE - - - LICENSE - NOTICE - .gitattributes - **/bnd.bnd - **/.checkstyle - .github/** - -
    - - - - format - - verify - - -
    - - - org.apache.rat - apache-rat-plugin - 0.13 - - - rat-check - - check - - - - - - **/*.svg - **/target - .travis.yml.* - bnd.bnd - *.log - .checkstyle - .factorypath - .editorconfig - **/META-INF/services/* - .github/** - **/license.html - **/license-efsl.adoc - **/LICENSE* - - - -
    -
    - - - - release - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.3 - true - - https://oss.sonatype.org/ - ossrh - ${autorelease} - ${keepStagingReposOnFailure} - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - - - - - - - custom-deploy - - - ${custom-deploy.id} - ${custom-deploy.url} - - - ${custom-deploy.id} - ${custom-deploy.url} - - - - diff --git a/spec/pom.xml b/spec/pom.xml index a2a0f933..ac18c012 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -1,7 +1,7 @@