[jboss-svn-commits] JBL Code SVN: r7498 - in labs/jbossesb/trunk/product/core/rosetta/src/org/jboss: internal/soa/esb/couriers soa/esb/couriers
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 9 10:48:16 EST 2006
Author: kurt.stam at jboss.com
Date: 2006-11-09 10:48:14 -0500 (Thu, 09 Nov 2006)
New Revision: 7498
Added:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierTimeoutException.java
Modified:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/Courier.java
Log:
Adding pickup support
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2006-11-09 15:19:51 UTC (rev 7497)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2006-11-09 15:48:14 UTC (rev 7498)
@@ -43,6 +43,7 @@
import org.jboss.soa.esb.addressing.eprs.JMSEpr;
import org.jboss.soa.esb.couriers.Courier;
import org.jboss.soa.esb.couriers.CourierException;
+import org.jboss.soa.esb.couriers.CourierTimeoutException;
import org.jboss.soa.esb.helpers.AppServerContext;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.message.Message;
@@ -201,19 +202,33 @@
protected List<KeyValuePair> _messageProperties;
- public Message deliverAndWaitForPickup(Message message, long waitTime) throws CourierException {
+ public Message deliverAndWaitForPickup(Message message, long waitTime) throws CourierException, CourierTimeoutException {
// TODO Auto-generated method stub
return null;
}
+ public boolean deliverNext(Message message) throws CourierException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ public Message pickup(long waitTime) throws CourierException, CourierTimeoutException {
+ // TODO Auto-generated method stub
+ return null;
+ }
public Message pickupNext(long waitTime) throws CourierException {
// TODO Auto-generated method stub
return null;
}
+ public void stopDurableDelivery() throws CourierException {
+ // TODO Auto-generated method stub
+
+ }
public void stopDurablePickup() throws CourierException {
// TODO Auto-generated method stub
}
+
+
}
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/Courier.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/Courier.java 2006-11-09 15:19:51 UTC (rev 7497)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/Courier.java 2006-11-09 15:48:14 UTC (rev 7498)
@@ -32,7 +32,7 @@
public interface Courier
{
/**
- * try to deliver an ESB message
+ * Try to deliver an ESB message. This is a one shot delivery.
*
* @param message Message - the message to deliver
* @return boolean - the result of the delivery
@@ -40,35 +40,58 @@
*/
public boolean deliver(Message message) throws CourierException;
/**
+ * Engage in a durable delivery contract if it isn't in place already and try to deliver
+ * an ESB message.
+ *
+ * @param message Message - the message to deliver
+ * @return boolean - the result of the delivery
+ * @throws CourierException - if problems were encountered
+ */
+ public boolean deliverNext(Message message) throws CourierException;
+ /**
* Waits for a certain amount of time (waitTime) at an address to pick up a message.
*
- * Question; should we allow for rescheduling (retry) a pickup?
- *
* @param message Message - the message to deliver.
* @param waitTime - Timeout for before giving up in millis.
* @return - the (reply)Message.
- * @throws CourierException
+ * @throws CourierException the courier fails (i.e. gets a flat tire).
+ * @throws CourierTimeoutException if the pickup timed out (nobody home).
*/
- public Message deliverAndWaitForPickup(Message message,long waitTime) throws CourierException;
+ public Message deliverAndWaitForPickup(Message message,long waitTime)
+ throws CourierException, CourierTimeoutException;
+ /**
+ * This will be replaced by stopPickup().
+ */
+ /**
+ * Instruct the courier to go to a certain address (EPR) and wait for a pickup. This
+ * is a one shot pickup.
+ *
+ * @param waitTime - Pickup timeout for before giving up on this pickup. Time in millis.
+ * @return - the message that was picked up.
+ * @throws CourierException the courier fails (i.e. gets a flat tire).
+ * @throws CourierTimeoutException if the pickup timed out (nobody home).
+ */
+ public Message pickup(long waitTime) throws CourierException, CourierTimeoutException;
/**
* Creates a durable pickup contract if one does not exist and tries to obtain the next message.
*
- * Question: is it cleaner to add a createDurablePickup() method?
- *
- @param waitTime - Pickup timeout for before giving up on this pickup. Time in millis.
+ * @param waitTime - Pickup timeout for before giving up on this pickup. Time in millis.
* @return - the message that was picked up.
* @throws CourierException
*/
public Message pickupNext(long waitTime) throws CourierException;
/**
* When you were engaged in a durable pickup, you need to notify the Courier you want to break
- * that contract. The courier will no longer go out for pickup.
+ * that contract. The courier will no longer stand by to go out for pickup.
*
* @throws CourierException
*/
public void stopDurablePickup() throws CourierException;
/**
- * This will be replaced by stopPickup().
- */
- public abstract void cleanup();
+ * When you were engaged in a durable delivary, you need to notify the Courier you want to break
+ * that contract. The courier will no longer stand by to deliver.
+ *
+ * @throws CourierException
+ */
+ public void stopDurableDelivery() throws CourierException;
}
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierTimeoutException.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierTimeoutException.java 2006-11-09 15:19:51 UTC (rev 7497)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierTimeoutException.java 2006-11-09 15:48:14 UTC (rev 7498)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.couriers;
+
+import org.jboss.soa.esb.BaseException;
+
+/**
+ * Timeout exception.
+ *
+ * @author kstam at redhat.com
+ */
+public class CourierTimeoutException extends BaseException
+{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct an exception instance.
+ * @param message Exception message.
+ */
+ public CourierTimeoutException(String message) { super(message); }
+
+ /**
+ * Construct an exception instance.
+ * @param message Exception message.
+ * @param cause Exception cause.
+ */
+ public CourierTimeoutException(String message, Throwable cause) { super(message, cause); }
+
+ /**
+ * Construct an exception instance.
+ * @param cause Exception cause.
+ */
+ public CourierTimeoutException(Throwable cause) { super(cause); }
+}
More information about the jboss-svn-commits
mailing list