From 84eb385ddc52f63a8fc28f25dbe8af2c751a8eb6 Mon Sep 17 00:00:00 2001
From: Rajith Muditha Attapattu
Date: Wed, 1 Aug 2007 22:27:03 +0000
Subject: StreamingMessageListener - was added to deliver message parts as an
when they are available as opposed to sending a completed message (as in
MessageListener)
Message - was added to abstract the message data underneath. this can be used in both broker and client
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@561980 13f79535-47bb-0310-9956-ffa450edef68
---
.../main/java/org/apache/qpidity/api/Message.java | 62 ++++++++++++++++++++++
.../qpidity/api/StreamingMessageListener.java | 60 +++++++++++++++++++++
2 files changed, 122 insertions(+)
create mode 100644 java/common/src/main/java/org/apache/qpidity/api/Message.java
create mode 100644 java/common/src/main/java/org/apache/qpidity/api/StreamingMessageListener.java
(limited to 'java/common')
diff --git a/java/common/src/main/java/org/apache/qpidity/api/Message.java b/java/common/src/main/java/org/apache/qpidity/api/Message.java
new file mode 100644
index 0000000000..6086cc6a49
--- /dev/null
+++ b/java/common/src/main/java/org/apache/qpidity/api/Message.java
@@ -0,0 +1,62 @@
+package org.apache.qpidity.api;
+
+import org.apache.qpidity.ApplicationProperties;
+import org.apache.qpidity.DeliveryProperties;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+public interface Message
+{
+ public ApplicationProperties getApplicationProperties();
+
+ public DeliveryProperties getDeliveryProperties();
+
+ /**
+ * This will abstract the underlying message data.
+ * The Message implementation may not hold all message
+ * data in memory (especially in the case of large messages)
+ *
+ * The appendData function might write data to
+ *
+ * - Memory (Ex: ByteBuffer)
+ *
- To Disk
+ *
- To Socket (Stream)
+ *
+ * @param src
+ */
+ public void appendData(byte[] src);
+
+ /**
+ * This will abstract the underlying message data.
+ * The Message implementation may not hold all message
+ * data in memory (especially in the case of large messages)
+ *
+ * The read function might copy data from a
+ *
+ * - From memory (Ex: ByteBuffer)
+ *
- From Disk
+ *
- From Socket as and when it gets streamed
+ *
+ * @param target
+ */
+ public void readData(byte[] target);
+
+}
+
diff --git a/java/common/src/main/java/org/apache/qpidity/api/StreamingMessageListener.java b/java/common/src/main/java/org/apache/qpidity/api/StreamingMessageListener.java
new file mode 100644
index 0000000000..b361e2ac82
--- /dev/null
+++ b/java/common/src/main/java/org/apache/qpidity/api/StreamingMessageListener.java
@@ -0,0 +1,60 @@
+package org.apache.qpidity.api;
+
+import org.apache.qpidity.Header;
+import org.apache.qpidity.Option;
+
+/**
+ * This message listener is useful if u need to
+ * know when each message part becomes available
+ * as opposed to knowing when the whole message arrives.
+ *
+ */
+public interface StreamingMessageListener
+{
+ /**
+ * Transfer the given message.
+ * Following are the valid options for messageTransfer
+ *
+ * - CONFIRM
+ *
- PRE_ACQUIRE
+ *
+ *
+ *
+ * In the absence of a particular option, the defaul value is:
+ *
+ * - CONFIRM = false
+ *
- NO-ACCQUIRE
+ *
+ *
+ *
+ * @param destination The exchange the message being sent.
+ * @return options set of options
+ * @throws QpidException If the session fails to send the message due to some error
+ */
+ public void messageTransfer(String destination,Option... options);
+
+ /**
+ * Add the following headers to content bearing frame
+ *
+ * @param Header Either DeliveryProperties or ApplicationProperties
+ * @throws QpidException If the session fails to execute the method due to some error
+ */
+ public void messageHeaders(Header ... headers);
+
+ /**
+ * Add the following byte array to the content.
+ * This method is useful when streaming large messages
+ *
+ * @param src data to be added or streamed
+ * @throws QpidException If the session fails to execute the method due to some error
+ */
+ public void data(byte[] src);
+
+ /**
+ * Signals the end of data for the message. *
+ * This method is useful when streaming large messages
+ *
+ * @throws QpidException If the session fails to execute the method due to some error
+ */
+ public void endData();
+}
--
cgit v1.2.1