Class JmsNamespaceBridge

java.lang.Object
com.trafficparrot.sdk.messaging.JmsNamespaceBridge
Direct Known Subclasses:
JmsNamespaceBridge

public class JmsNamespaceBridge extends Object
Bridges between javax.jms and jakarta.jms namespaces using dynamic proxies. This bridge exists ONLY for backward compatibility with old customer plugins that use javax.jms.

Jakarta-based plugins are first-class citizens and should receive native jakarta.jms objects directly -- they should never need bridging. The framework calls jakarta plugins via JmsResponseTransformer.transformJakarta(com.trafficparrot.sdk.messaging.Destination, jakarta.jms.Message, com.trafficparrot.sdk.messaging.JmsResponse, com.github.tomakehurst.wiremock.extension.Parameters) which passes the native jakarta.jms.Message without any wrapping.

The bridge is used only when calling old javax.jms customer plugins: it wraps the native jakarta.jms objects as javax.jms proxies so that legacy plugin code can work unchanged.

The bridge handles:

  • Return value wrapping: methods returning JMS types (e.g., getJMSDestination(), getJMSReplyTo()) are automatically wrapped to the caller's expected namespace.
  • Argument type conversion: method parameter types are mapped across namespaces so that e.g. setJMSReplyTo(Destination) resolves to the delegate's namespace.
  • Exception propagation: InvocationTargetException is unwrapped so checked exceptions (e.g., JMSException) propagate directly without UndeclaredThrowableException wrapping.
  • Double-proxy unwrap: if a message is already a bridge proxy wrapping an object of the target namespace, the original object is returned instead of creating a nested proxy.
  • Constructor Details

    • JmsNamespaceBridge

      public JmsNamespaceBridge()
  • Method Details

    • wrapAsJakarta

      public static <T extends jakarta.jms.Message> T wrapAsJakarta(javax.jms.Message javaxMessage)
    • wrapAsJavax

      public static <T extends javax.jms.Message> T wrapAsJavax(jakarta.jms.Message jakartaMessage)