cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-7135] Updating JMS ConnectionFactoryFeature to support InterceptorProvider
Date Mon, 21 Nov 2016 10:08:16 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes e04b405eb -> 9f5d47d90


[CXF-7135] Updating JMS ConnectionFactoryFeature to support InterceptorProvider


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9f5d47d9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9f5d47d9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9f5d47d9

Branch: refs/heads/3.0.x-fixes
Commit: 9f5d47d905ff6bca5e60a0fb05e869cb32037dcc
Parents: e04b405
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Nov 21 10:02:19 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Nov 21 10:08:01 2016 +0000

----------------------------------------------------------------------
 .../transport/jms/ConnectionFactoryFeature.java | 31 +++++++++++++-------
 1 file changed, 21 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9f5d47d9/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ConnectionFactoryFeature.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ConnectionFactoryFeature.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ConnectionFactoryFeature.java
index dca3e43..ee0dfaa 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ConnectionFactoryFeature.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ConnectionFactoryFeature.java
@@ -26,6 +26,7 @@ import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
@@ -47,17 +48,14 @@ public class ConnectionFactoryFeature extends AbstractFeature {
 
     @Override
     public void initialize(Client client, Bus bus) {
-        client.getEndpoint().getOutInterceptors().add(new AbstractPhaseInterceptor<Message>(Phase.PREPARE_SEND)
{
-            public void handleMessage(Message message) throws Fault {
-                Conduit conduit = message.getExchange().getConduit(message);
-                if (conduit instanceof JMSConduit) {
-                    JMSConduit jmsConduit = (JMSConduit)conduit;
-                    jmsConduit.getJmsConfig().setConnectionFactory(connectionFactory);
-                }
-            }
-        });
+        client.getEndpoint().getOutInterceptors().add(new JMSConduitConfigOutInterceptor());
         super.initialize(client, bus);
     }
+    @Override
+    public void initialize(InterceptorProvider provider, Bus bus) {
+        provider.getOutInterceptors().add(new JMSConduitConfigOutInterceptor());
+        super.initialize(provider, bus);
+    }
 
     @Override
     public void initialize(Server server, Bus bus) {
@@ -68,5 +66,18 @@ public class ConnectionFactoryFeature extends AbstractFeature {
         }
         super.initialize(server, bus);
     }
-    
+    private class JMSConduitConfigOutInterceptor extends AbstractPhaseInterceptor<Message>
{
+        JMSConduitConfigOutInterceptor() {
+            super(Phase.PREPARE_SEND);
+        }
+
+        @Override
+        public void handleMessage(Message message) throws Fault {
+            Conduit conduit = message.getExchange().getConduit(message);
+            if (conduit instanceof JMSConduit) {
+                JMSConduit jmsConduit = (JMSConduit)conduit;
+                jmsConduit.getJmsConfig().setConnectionFactory(connectionFactory);
+            }
+        }
+    }
 }


Mime
View raw message