You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2007/08/02 00:27:05 UTC

svn commit: r561980 - in /incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api: ./ Message.java StreamingMessageListener.java

Author: rajith
Date: Wed Aug  1 15:27:03 2007
New Revision: 561980

URL: http://svn.apache.org/viewvc?view=rev&rev=561980
Log:
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


Added:
    incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/
    incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/Message.java
    incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/StreamingMessageListener.java

Added: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/Message.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/Message.java?view=auto&rev=561980
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/Message.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/Message.java Wed Aug  1 15:27:03 2007
@@ -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 
+	 * <ul>
+	 * <li> Memory (Ex: ByteBuffer)
+	 * <li> To Disk
+	 * <li> To Socket (Stream)
+	 * </ul>
+	 * @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 
+	 * <ul>
+	 * <li> From memory (Ex: ByteBuffer)
+	 * <li> From Disk
+	 * <li> From Socket as and when it gets streamed
+	 * </ul>
+	 * @param target
+	 */
+    public void readData(byte[] target);   
+
+}
+

Added: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/StreamingMessageListener.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/StreamingMessageListener.java?view=auto&rev=561980
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/StreamingMessageListener.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/api/StreamingMessageListener.java Wed Aug  1 15:27:03 2007
@@ -0,0 +1,60 @@
+package org.apache.qpidity.api;
+
+import org.apache.qpidity.Header;
+import org.apache.qpidity.Option;
+
+/**
+ * <p>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.</p>
+ *
+ */
+public interface StreamingMessageListener
+{
+	/**
+     * Transfer the given message.
+     * <p> Following are the valid options for messageTransfer
+     * <ul>
+     * <li> CONFIRM
+     * <li> PRE_ACQUIRE
+     * </ul>
+     * </p>
+     *
+     * <p> In the absence of a particular option, the defaul value is:
+     * <ul>
+     * <li> CONFIRM = false
+     * <li> NO-ACCQUIRE
+     * </ul>
+     * </p>
+     * 
+     * @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(); 
+}