pjfanning opened a new pull request, #2053:
URL: https://github.com/apache/pekko-connectors/pull/2053

   ### Motivation
   Parts of the jms and jakartams APIs are awkward or unusable from Java (see 
#2043):
   - the Java `CustomDestination` constructor taking a 
`java.util.function.Function` is ambiguous with the primary constructor for 
Java lambdas ("reference to CustomDestination is ambiguous");
   - `JmsObjectMessagePassThrough` has no `java.util.Map` `withProperties`, and 
doesn't extend `JmsEnvelopeWithProperties` like the other messages;
   - `withHeaders` only takes a Scala `Set`, `JmsMapMessagePassThrough.body` is 
a Scala `Map`, and `JmsTimeToLive` can't be created from a `java.time.Duration`;
   - settings getters return `Option`, Scala `Duration` or `FiniteDuration`.
   
   ### Modification
   The same changes are applied to jms and jakartams:
   - Add `CustomDestination.fromFunction` and deprecate the Java constructor. A 
static `create` isn't possible because `CustomDestination` has a `create` 
member, so scalac skips the forwarder. The Java docs examples now use the new 
factory, and the explicit companion keeps the `AbstractFunction2` parent.
   - Add `JmsObjectMessagePassThrough.withProperties(java.util.Map)` and make 
it a `JmsEnvelopeWithProperties`.
   - Add `withHeaders(java.util.Set)` to `JmsMessage` and the message classes, 
plus `JmsMapMessagePassThrough.getBody` and 
`JmsTimeToLive.create(java.time.Duration)`.
   - Add Java getters (`Optional`, `java.time.Duration`) to the consumer, 
producer, browse, connection-retry and send-retry settings. An infinite ack 
timeout or time to live is returned as `ChronoUnit.FOREVER.getDuration`.
   
   New APIs are tagged `@since 2.0.0`. Binary compatible.
   
   ### Result
   The JMS connectors can be configured and inspected from Java without Scala 
types or ambiguous lambdas.
   
   ### Tests
   - `sbt "jms/Test/testOnly 
org.apache.pekko.stream.connectors.jms.javadsl.JmsJavaApiTest"` - passed (did 
not compile before)
   - `sbt "jakartams/Test/testOnly 
org.apache.pekko.stream.connectors.jakartams.javadsl.JakartaJmsJavaApiTest"` - 
passed
   - `sbt jms/mimaReportBinaryIssues jakartams/mimaReportBinaryIssues` - passed
   - `scalafmt` and `javafmtAll` (JDK 17) run
   - Broker integration tests and `docs/paradox` - not run locally
   
   ### References
   Refs #2043
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to