|
Mmm... that a tough question cause I refactored the examples to Maven
based build, but... I reproduced the issue in the original samples, see
attached the modified/added files. For completeness I also created a
zip file containing both sample projects, this can be downloaded at
http://gerodt.homeip.net/wsn-samples.zip (this file is ~45M, but the
attached files should enable you to reproduce it). Changed in wsn-consumer:
If you take the original wsn-producer.war file you will see 'INFO: Received message:... ' messages in the catalina.out file of Tomcat. The messages are logged by the ConsumerCapabilityImpl class of the wsn-consumer. Once you deploy the modified wsn-producer that sends the contents of the 'troubleTicketCreateEvent.xml' as notification, the 'INFO: Received message:... ' messages will no longer be logged and the accept() and process() messages in the consumer are no longer being invoked. Thanks for looking into it. Regards, Gero Daniel Jemiolo wrote: Can you send us the files that you changed? Or the new code, if you only changed Java? I will try to recreate your steps and see what happens. Make sure you document *every* file change. :)Dan Gero Vermaas <[EMAIL PROTECTED]> wrote on 10/17/2006 02:39:32 PM: |
<?xml version="1.0"?>
<project name="project" default="war">
<target name="init">
<basename property="NAME" file="${basedir}"/>
<property name="MUSE_HOME" value="../.."/>
<property name="MUSE_TEMPLATE" value="${MUSE_HOME}/lib/axis2"/>
<property name="BUILD_DIR" value="build"/>
<property name="JAVA_SRC_DIR" value="src"/>
<property name="JAVA_DEST_DIR" value="${BUILD_DIR}/bin"/>
<property name="WAR_FILE" value="${BUILD_DIR}/${NAME}.war"/>
<property name="LIB_DIR" value="${BUILD_DIR}/WEB-INF/lib"/>
<property name="JAR_FILE" value="${LIB_DIR}/${NAME}.jar"/>
<path id="muse.class.path">
<fileset dir="${MUSE_HOME}/modules/ws-fx-api/">
<include name="*.jar"/>
</fileset>
<fileset dir="${MUSE_HOME}/modules/ws-fx-impl/">
<include name="*.jar"/>
</fileset>
<fileset dir="${MUSE_HOME}/modules/core/">
<include name="*.jar"/>
</fileset>
<fileset dir="${MUSE_TEMPLATE}/WEB-INF/lib">
<include name="wsdl4j*.jar"/>
</fileset>
</path>
</target>
<target name="layout" depends="init, clean">
<copy todir="${BUILD_DIR}">
<fileset dir="${MUSE_TEMPLATE}">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${BUILD_DIR}/WEB-INF/services/muse/">
<fileset dir=".">
<include name="wsdl/**"/>
<include name="router-entries/**"/>
</fileset>
</copy>
<copy todir="${BUILD_DIR}/WEB-INF/services/muse/META-INF">
<fileset dir="config">
<include name="services.xml"/>
</fileset>
</copy>
<copy todir="${BUILD_DIR}/WEB-INF/services/muse">
<fileset dir="config">
<include name="muse.xml"/>
</fileset>
</copy>
<copy todir="${LIB_DIR}" flatten="true">
<fileset dir="${MUSE_HOME}/modules">
<include name="ws-fx-api/*.jar"/>
<include name="axis2/*.jar"/>
<include name="ws-fx-impl/*.jar"/>
<include name="core/*.jar"/>
</fileset>
</copy>
</target>
<target name="java" depends="layout">
<mkdir dir="${JAVA_DEST_DIR}"/>
<javac srcdir="${JAVA_SRC_DIR}" destdir="${JAVA_DEST_DIR}" classpathref="muse.class.path"/>
<jar basedir="${JAVA_DEST_DIR}" destfile="${JAR_FILE}">
<fileset dir="${JAVA_DEST_DIR}">
<include name="**/*.class"/>
</fileset>
</jar>
</target>
<target name="war" depends="java">
<jar destfile="${WAR_FILE}">
<fileset dir="${BUILD_DIR}">
<include name="WEB-INF/**"/>
</fileset>
</jar>
</target>
<target name="clean" depends="init">
<delete dir="${BUILD_DIR}"/>
</target>
<target name="run">
<java className="org.apache.muse.test.wsn.WsnTestClient">
<classpath>
<fileset dir="build/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</java>
</target>
</project>
<?xml version="1.0"?>
<project name="project" default="war">
<target name="init">
<basename property="NAME" file="${basedir}"/>
<property name="MUSE_HOME" value="../.."/>
<property name="MUSE_TEMPLATE" value="${MUSE_HOME}/lib/axis2"/>
<property name="BUILD_DIR" value="build"/>
<property name="JAVA_SRC_DIR" value="src"/>
<property name="JAVA_DEST_DIR" value="${BUILD_DIR}/bin"/>
<property name="WAR_FILE" value="${BUILD_DIR}/${NAME}.war"/>
<property name="LIB_DIR" value="${BUILD_DIR}/WEB-INF/lib"/>
<property name="JAR_FILE" value="${LIB_DIR}/${NAME}.jar"/>
<path id="muse.class.path">
<fileset dir="${MUSE_HOME}/modules/ws-fx-api/">
<include name="*.jar"/>
</fileset>
<fileset dir="${MUSE_HOME}/modules/ws-fx-impl/">
<include name="*.jar"/>
</fileset>
<fileset dir="${MUSE_HOME}/modules/core/">
<include name="*.jar"/>
</fileset>
<fileset dir="${MUSE_TEMPLATE}/WEB-INF/lib">
<include name="wsdl4j*.jar"/>
</fileset>
</path>
</target>
<target name="layout" depends="init, clean">
<copy todir="${BUILD_DIR}">
<fileset dir="${MUSE_TEMPLATE}">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${BUILD_DIR}/WEB-INF/services/muse/">
<fileset dir=".">
<include name="wsdl/**"/>
<include name="router-entries/**"/>
</fileset>
</copy>
<copy todir="${BUILD_DIR}/WEB-INF/services/muse/META-INF">
<fileset dir="config">
<include name="services.xml"/>
</fileset>
</copy>
<copy todir="${BUILD_DIR}/WEB-INF/services/muse">
<fileset dir="config">
<include name="muse.xml"/>
</fileset>
</copy>
<copy todir="${LIB_DIR}" flatten="true">
<fileset dir="${MUSE_HOME}/modules">
<include name="ws-fx-api/*.jar"/>
<include name="axis2/*.jar"/>
<include name="ws-fx-impl/*.jar"/>
<include name="core/*.jar"/>
</fileset>
</copy>
<!-- GV ADDED -->
<copy todir="${BUILD_DIR}/WEB-INF/classes" file="troubleTicketCreateEvent.xml"/>
<!-- GV EO ADDED -->
</target>
<target name="java" depends="layout">
<mkdir dir="${JAVA_DEST_DIR}"/>
<javac srcdir="${JAVA_SRC_DIR}" destdir="${JAVA_DEST_DIR}" classpathref="muse.class.path"/>
<jar basedir="${JAVA_DEST_DIR}" destfile="${JAR_FILE}">
<fileset dir="${JAVA_DEST_DIR}">
<include name="**/*.class"/>
</fileset>
</jar>
</target>
<target name="war" depends="java">
<jar destfile="${WAR_FILE}">
<fileset dir="${BUILD_DIR}">
<include name="WEB-INF/**"/>
</fileset>
</jar>
</target>
<target name="clean" depends="init">
<delete dir="${BUILD_DIR}"/>
</target>
</project>
<tt:troubleTicketCreateEvent xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tt="http://java.sun.com/products/oss/xml/TroubleTicket" xmlns:fm="http://java.sun.com/products/oss/xml/QualityOfService/FM/Monitor" xmlns:measurement="http://java.sun.com/products/oss/xml/QualityOfService/PM/Measurement" xmlns:threshold="http://java.sun.com/products/oss/xml/QualityOfService/PM/Threshold" xmlns:co="http://java.sun.com/products/oss/xml/Common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/products/oss/xml/TroubleTicket/XmlTroubleTicketSchema.xsd"> <tt:event> <co:applicationDN>System/RI/ApplicationType/TroubleTicket/Application/1-0;1-0-2;OSSJTTRI</co:applicationDN> <co:eventTime>2006-06-05T06:16:46Z</co:eventTime> <tt:troubleTicketValue> <co:lastUpdateVersionNumber>0</co:lastUpdateVersionNumber> <tt:troubleTicketKey> <co:applicationContext> <co:factoryClass>com.sun.jndi.cosnaming.CNCtxFactory</co:factoryClass> <co:url>"iiop://127.0.0.1:3700"</co:url> <co:systemProperties/> </co:applicationContext> <co:applicationDN>System/RI/ApplicationType/TroubleTicket/Application/1-0;1-0-2;OSSJTTRI</co:applicationDN> <co:type>tt:TroubleTicketValue</co:type> <tt:primaryKey>1149524206107</tt:primaryKey> </tt:troubleTicketKey> </tt:troubleTicketValue> </tt:event> </tt:troubleTicketCreateEvent>
/*=============================================================================* * Copyright 2006 The Apache Software Foundation * * Licensed 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. *=============================================================================*/ package org.apache.ws.muse.test.wsrf; import javax.xml.namespace.QName; import java.io.InputStream; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import java.io.InputStream; import org.w3c.dom.Element; import org.xml.sax.InputSource; import org.apache.muse.util.xml.XmlUtils; import org.apache.muse.ws.addressing.soap.SoapFault; import org.apache.muse.ws.notification.NotificationProducer; import org.apache.muse.ws.notification.WsnConstants; import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability; public class MyCapabilityImpl extends AbstractWsResourceCapability implements MyCapability { private static final QName[] _PROPERTIES = new QName[] { new QName(NAMESPACE_URI, "MessageInterval", PREFIX), new QName(NAMESPACE_URI, "ServerName", PREFIX) }; private static final QName _TOPIC_NAME = new QName(NAMESPACE_URI, "MyTopic", PREFIX); public QName[] getPropertyNames() { return _PROPERTIES; } private int _MessageInterval = 10; private String _ServerName = "muse-test.apache.org"; public int getMessageInterval() { return _MessageInterval; } public void setMessageInterval(int param0) { _MessageInterval = param0; } public String getServerName() { return _ServerName; } public void setServerName(String param0) { _ServerName = param0; } public void initializeCompleted() throws SoapFault { super.initializeCompleted(); // // access resource's WSN capability and create a new topic // final NotificationProducer wsn = (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI); wsn.addTopic(_TOPIC_NAME); Thread producer = new Thread() { public void run() { try { QName messageName = new QName(NAMESPACE_URI, "MyMessage", PREFIX); InputStream is = MyCapabilityImpl.class. getResourceAsStream("/troubleTicketCreateEvent.xml"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(new InputSource(is)); // read current value - property is mutable int currentInterval = getMessageInterval(); getLog().info("Waiting " + currentInterval + " seconds before sending message..."); Thread.currentThread().sleep(currentInterval * 1000); getLog().info("Sending message to consumers..."); wsn.publish(_TOPIC_NAME, document.getDocumentElement()); } catch(Throwable error) { error.printStackTrace(); } } /* public void run() { // // for this example, reuse one payload for every notification // QName messageName = new QName(NAMESPACE_URI, "MyMessage", PREFIX); String message = "This is a message from " + getServerName(); Element payload = XmlUtils.createElement(messageName, message); while (true) { try { // // read current value - property is mutable // int currentInterval = getMessageInterval(); getLog().info("Waiting " + currentInterval + " seconds before sending message..."); Thread.currentThread().sleep(currentInterval * 1000); // // use WSN capability to send message to any subscribers // getLog().info("Sending message to consumers..."); wsn.publish(_TOPIC_NAME, payload); } catch (Throwable error) { error.printStackTrace(); } } } */ }; producer.start(); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
