summaryrefslogtreecommitdiff
path: root/java/client
diff options
context:
space:
mode:
Diffstat (limited to 'java/client')
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSession.java13
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSessionDelegate.java41
2 files changed, 49 insertions, 5 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSession.java b/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSession.java
index 714601032a..f3ef74a2e9 100644
--- a/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSession.java
+++ b/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSession.java
@@ -1,5 +1,6 @@
package org.apache.qpid.nclient.impl;
+import java.util.HashMap;
import java.util.Map;
import org.apache.qpidity.api.Message;
@@ -12,6 +13,8 @@ import org.apache.qpidity.*;
public class ClientSession implements org.apache.qpid.nclient.Session
{
+ Map<String,MessagePartListener> messagListeners = new HashMap<String,MessagePartListener>();
+
//------------------------------------------------------
// Session housekeeping methods
//------------------------------------------------------
@@ -68,11 +71,6 @@ public class ClientSession implements org.apache.qpid.nclient.Session
//To change body of implemented methods use File | Settings | File Templates.
}
- public void setMessageListener(String destination, MessagePartListener listener)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
public void messageAcknowledge(Range... range) throws QpidException
{
//To change body of implemented methods use File | Settings | File Templates.
@@ -147,4 +145,9 @@ public class ClientSession implements org.apache.qpid.nclient.Session
{
//To change body of implemented methods use File | Settings | File Templates.
}
+
+ public void setMessageListener(String destination,MessagePartListener listener)
+ {
+ messagListeners.put(destination, listener);
+ }
}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSessionDelegate.java b/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSessionDelegate.java
index 855fd1187f..aee0e874af 100644
--- a/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSessionDelegate.java
+++ b/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSessionDelegate.java
@@ -1,12 +1,53 @@
package org.apache.qpid.nclient.impl;
+import org.apache.qpid.nclient.MessagePartListener;
import org.apache.qpidity.CommonSessionDelegate;
import org.apache.qpidity.ExchangeQueryOk;
+import org.apache.qpidity.Header;
+import org.apache.qpidity.MessageTransfer;
+import org.apache.qpidity.Option;
+import org.apache.qpidity.QpidException;
import org.apache.qpidity.Session;
public class ClientSessionDelegate extends CommonSessionDelegate
{
+
+ /*@Override public void messageTransfer(Session context, MessageTransfer struct)
+ {
+ MessagePartListener l = context.messagListeners.get(struct.getDestination());
+ l.messageTransfer(struct.getDestination(),new Option[0]);
+ }*/
+
+ // ---------------------------------------------------------------
+ // Non generated methods - but would like if they are also generated.
+ // These methods should be called from Body and Header Handlers.
+ // If these methods are generated as part of the delegate then
+ // I can call these methods from the BodyHandler and HeaderHandler
+ // in a generic way
+
+ // I have used destination to indicate my intent of receiving
+ // some form of correlation to know which consumer this data belongs to.
+ // It can be anything as long as I can make the right correlation
+ // ----------------------------------------------------------------
+ /* public void data(Session context,String destination,byte[] src) throws QpidException
+ {
+ MessagePartListener l = context.messagListeners.get(destination);
+ l.data(src);
+ }
+
+ public void endData(Session context,String destination) throws QpidException
+ {
+ MessagePartListener l = context.messagListeners.get(destination);
+ l.endData();
+ }
+
+ public void messageHeaders(Session context,String destination,Header... headers) throws QpidException
+ {
+ MessagePartListener l = context.messagListeners.get(destination);
+ l.endData();
+ }*/
+
// --------------------------------------------
// Exchange related functionality