diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2007-08-01 22:27:03 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2007-08-01 22:27:03 +0000 |
commit | 84eb385ddc52f63a8fc28f25dbe8af2c751a8eb6 (patch) | |
tree | ea7a74cb547f65778ff55832a411fe4548f3d9ec | |
parent | 0d3bf841ef82c83b6c760c96dbeaef81ab9986da (diff) | |
download | qpid-python-84eb385ddc52f63a8fc28f25dbe8af2c751a8eb6.tar.gz |
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
-rw-r--r-- | java/common/src/main/java/org/apache/qpidity/api/Message.java | 62 | ||||
-rw-r--r-- | java/common/src/main/java/org/apache/qpidity/api/StreamingMessageListener.java | 60 |
2 files changed, 122 insertions, 0 deletions
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 + * <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); + +} + 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; + +/** + * <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(); +} |