diff -Naur svnsrc/main/java/org/jboss/ws/eventing/element/NotificationFailure.java src/main/java/org/jboss/ws/eventing/element/NotificationFailure.java --- svnsrc/main/java/org/jboss/ws/eventing/element/NotificationFailure.java 1970-01-01 01:00:00.000000000 +0100 +++ src/main/java/org/jboss/ws/eventing/element/NotificationFailure.java 2006-11-29 18:49:33.257123374 +0100 @@ -0,0 +1,71 @@ +/* + * Created on 25/11/2006 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +package org.jboss.ws.eventing.element; + +import java.net.URI; + +import org.jboss.ws.utils.DOMWriter; +import org.w3c.dom.Element; + +/** + * + * @author Stefano Maestri , Alessio Soldano + * @since 26/11/2006 + * represent an error during notification + */ + +public class NotificationFailure +{ + private URI endTo; + private Element event; + private Exception exception; + + public NotificationFailure(URI endTo, Element event, Exception exception) + { + super(); + this.endTo = endTo; + this.event = event; + this.exception = exception; + } + public URI getEndTo() + { + return endTo; + } + public void setEndTo(URI endTo) + { + this.endTo = endTo; + } + public Element getEvent() + { + return event; + } + public void setEvent(Element event) + { + this.event = event; + } + public Exception getException() + { + return exception; + } + public void setException(Exception exception) + { + this.exception = exception; + } + + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("endTo: "); + sb.append(endTo); + sb.append("\n\nevent: "); + sb.append(DOMWriter.printNode(event, false)); + sb.append("\n\nexception: "); + sb.append(exception); + sb.append("\n*******************\n"); + return sb.toString(); + } + +} diff -Naur svnsrc/main/java/org/jboss/ws/eventing/mgmt/Subscription.java src/main/java/org/jboss/ws/eventing/mgmt/Subscription.java --- svnsrc/main/java/org/jboss/ws/eventing/mgmt/Subscription.java 2006-11-29 16:59:50.356746311 +0100 +++ src/main/java/org/jboss/ws/eventing/mgmt/Subscription.java 2006-11-29 18:40:33.911111754 +0100 @@ -29,6 +29,9 @@ import org.jboss.ws.utils.DOMWriter; import org.jboss.ws.eventing.EventingConstants; import org.jboss.ws.eventing.element.EndpointReference; +import org.jboss.ws.eventing.element.NotificationFailure; +import org.jboss.ws.eventing.mgmt.SubscriptionManagerFactory; +import org.jboss.ws.eventing.mgmt.SubscriptionManagerMBean; import org.jboss.ws.soap.SOAPConnectionImpl; import org.w3c.dom.Element; @@ -59,6 +62,8 @@ final private EndpointReference endpointReference; final private URI eventSourceNS; + private SubscriptionManagerFactory factory = SubscriptionManagerFactory.getInstance(); + public Subscription(URI eventSourceNS, EndpointReference endpointReference, EndpointReference notifyTo, EndpointReference endTo, Date expires, Filter filter) { this.eventSourceNS = eventSourceNS; @@ -99,7 +104,9 @@ } catch (Exception e) { - // todo: this should get back to manager + SubscriptionManagerMBean manager = factory.getSubscriptionManager(); + NotificationFailure failure = new NotificationFailure(this.endTo.getAddress(), event, e); + manager.addNotificationFailure(failure); log.error("Failed to send notification message", e); } } @@ -219,4 +226,5 @@ { this.expires = expires; } + } diff -Naur svnsrc/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManager.java src/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManager.java --- svnsrc/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManager.java 2006-11-29 16:59:50.410739180 +0100 +++ src/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManager.java 2006-11-30 14:57:24.045114839 +0100 @@ -29,6 +29,7 @@ import org.jboss.ws.eventing.EventingConstants; import org.jboss.ws.eventing.deployment.EventingEndpointDI; import org.jboss.ws.eventing.element.EndpointReference; +import org.jboss.ws.eventing.element.NotificationFailure; import org.jboss.ws.eventing.element.ReferenceParameters; import org.jboss.ws.utils.ObjectNameFactory; import org.jboss.ws.utils.UUIDGenerator; @@ -45,6 +46,7 @@ import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Date; +import java.util.LinkedList; import java.util.List; import java.util.concurrent.*; @@ -78,6 +80,12 @@ private static final Logger log = Logger.getLogger(SubscriptionManager.class); private long MAX_LEASE_TIME = 1000 * 60 * 10L; public long DEFAULT_LEASE = 1000 * 60 * 5L; + + /** + * List containing all errors occured during notification since service startup + * todo: save this list and made possible to resend failed notification using jms instead of list + */ + private List notificationFailures = new LinkedList(); public static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=SubscriptionManager,module=eventing"); @@ -526,6 +534,15 @@ return (int) this.MAX_LEASE_TIME/60/1000; } + public void addNotificationFailure(NotificationFailure failure) + { + notificationFailures.add(failure); + } + + public List showNotificationFailures() + { + return notificationFailures; + } /** * The watchdog maintains subscription expirations. @@ -593,4 +610,5 @@ } return server; } + } diff -Naur svnsrc/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManagerMBean.java src/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManagerMBean.java --- svnsrc/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManagerMBean.java 2006-11-29 16:59:50.358746047 +0100 +++ src/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManagerMBean.java 2006-11-29 19:08:43.281361142 +0100 @@ -25,9 +25,11 @@ import java.net.URI; import java.util.Date; +import java.util.List; import org.jboss.ws.eventing.deployment.EventingEndpointDI; import org.jboss.ws.eventing.element.EndpointReference; +import org.jboss.ws.eventing.element.NotificationFailure; import org.w3c.dom.Element; /** @@ -66,6 +68,9 @@ public void setDefaultLeaseTimeMins(int mins); public int getDefaultLeaseTimeMins(); + + public void addNotificationFailure(NotificationFailure failure); + public List showNotificationFailures(); // ---------------------------------------------------------------------------- // Read only attributes @@ -111,4 +116,5 @@ String showSubscriptionTable(); String showEventsourceTable(); + }