You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2017/03/16 12:35:53 UTC
svn commit: r1787171 - in /uima/uima-ducc/trunk: src/main/resources/
uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/
uima-ducc-common/src/main/java/org/apache/uima/ducc/common/config/
uima-ducc-container/src/test/resources/ducc_runtime/resources/...
Author: degenaro
Date: Thu Mar 16 12:35:52 2017
New Revision: 1787171
URL: http://svn.apache.org/viewvc?rev=1787171&view=rev
Log:
UIMA-4883 DUCC system events log
In particular, SM CLI/API requests via HTTP to OR, then AMQ to SM.
Added:
uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/SmChannel.java (with props)
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRequestEvent.java (with props)
Modified:
uima/uima-ducc/trunk/src/main/resources/default.ducc.properties
uima/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceApi.java
uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/config/CommonConfiguration.java
uima/uima-ducc/trunk/uima-ducc-container/src/test/resources/ducc_runtime/resources/ducc.properties
uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/config/OrchestratorConfiguration.java
uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/OrchestratorEventListener.java
uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/system/events/log/SystemEventsLogger.java
uima/uima-ducc/trunk/uima-ducc-orchestrator/src/test/resources/ducc_runtime/resources/ducc.properties
uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/config/ServiceManagerConfiguration.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/dispatcher/DuccEventDispatcher.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceDisableEvent.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceEnableEvent.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceIgnoreEvent.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceModifyEvent.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceObserveEvent.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceQueryEvent.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRegisterEvent.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceStartEvent.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceStopEvent.java
uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceUnregisterEvent.java
Modified: uima/uima-ducc/trunk/src/main/resources/default.ducc.properties
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/resources/default.ducc.properties?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/resources/default.ducc.properties (original)
+++ uima/uima-ducc/trunk/src/main/resources/default.ducc.properties Thu Mar 16 12:35:52 2017
@@ -471,6 +471,12 @@ ducc.jd.error.handler.args = max_job_err
# This is the name of the pluggable java class used to implement the Service Manager.
ducc.sm.configuration.class=org.apache.uima.ducc.sm.config.ServiceManagerConfiguration
+# This is the JMS endpoint name used for API messages received by the Service Manager.
+ducc.sm.api.endpoint=ducc.sm.api
+
+# This is the JMS message type used for API messages received by the Service Manager.
+ducc.sm.api.endpoint.type=queue
+
# This is the JMS endpoint name used for state messages sent by the Service Manager.
ducc.sm.state.update.endpoint=ducc.sm.state
@@ -524,9 +530,6 @@ ducc.sm.meta.ping.stability = 10
# not respond within this time the ping is accounted for as a "missed" ping.
ducc.sm.meta.ping.timeout = 15000
-# This is the HTTP port used by the Service Manager to field requests from the CLI / API.
-ducc.sm.http.port=19989
-
# This is the node where the Service Manager runs. It MUST be configured as part of DUCC
# setup. The ducc_post_install procedures initialize this to ${ducc.head}
ducc.sm.http.node=${ducc.head}
Modified: uima/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceApi.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceApi.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceApi.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceApi.java Thu Mar 16 12:35:52 2017
@@ -51,6 +51,8 @@ public class DuccServiceApi
extends CliBase
{
+ private static String target_daemon = "orchestrator";
+
String endpoint = null;
IDuccCallback callback = null;
@@ -371,7 +373,7 @@ public class DuccServiceApi
throws Exception
{
DuccProperties dp = new SpecificationProperties();
- init (this.getClass().getName(), registration_options, args, null, dp, callback, "sm");
+ init (this.getClass().getName(), registration_options, args, null, dp, callback, target_daemon);
// Note: dp & cli_props are identical ... use only the class variable here for consistency
@@ -492,7 +494,7 @@ public class DuccServiceApi
throws Exception
{
DuccProperties dp = new SpecificationProperties();
- init(this.getClass().getName(), unregister_options, args, null, dp, callback, "sm");
+ init(this.getClass().getName(), unregister_options, args, null, dp, callback, target_daemon);
Pair<Integer, String> id = getId(UiOption.Unregister);
@@ -521,7 +523,7 @@ public class DuccServiceApi
throws Exception
{
DuccProperties dp = new SpecificationProperties();
- init(this.getClass().getName(), start_options, args, null, dp, callback, "sm");
+ init(this.getClass().getName(), start_options, args, null, dp, callback, target_daemon);
Pair<Integer, String> id = getId(UiOption.Start);
String user = dp.getProperty(UiOption.User.pname());
@@ -555,7 +557,7 @@ public class DuccServiceApi
throws Exception
{
DuccProperties dp = new SpecificationProperties();
- init(this.getClass().getName(), stop_options, args, null, dp, callback, "sm");
+ init(this.getClass().getName(), stop_options, args, null, dp, callback, target_daemon);
Pair<Integer, String> id = getId(UiOption.Stop);
String user = dp.getProperty(UiOption.User.pname());
@@ -591,7 +593,7 @@ public class DuccServiceApi
DuccProperties dp = new SpecificationProperties();
inhibitDefaults();
- init (this.getClass().getName(), modify_options, args, null, dp, callback, "sm");
+ init (this.getClass().getName(), modify_options, args, null, dp, callback, target_daemon);
enrichPropertiesForDebug(UiOption.Modify);
@@ -623,7 +625,7 @@ public class DuccServiceApi
{
DuccProperties dp = new SpecificationProperties();
- init (this.getClass().getName(), modify_options, args, null, dp, callback, "sm");
+ init (this.getClass().getName(), modify_options, args, null, dp, callback, target_daemon);
Pair<Integer, String> id = getId(UiOption.Modify);
String user = dp.getProperty(UiOption.User.pname());
@@ -678,7 +680,7 @@ public class DuccServiceApi
throws Exception
{
DuccProperties dp = new SpecificationProperties();
- init(this.getClass().getName(), query_options, args, null, dp, callback, "sm");
+ init(this.getClass().getName(), query_options, args, null, dp, callback, target_daemon);
Pair<Integer, String> id = null;
String sid = cli_props.getProperty(UiOption.Query.pname()).trim();
@@ -704,7 +706,7 @@ public class DuccServiceApi
throws Exception
{
DuccProperties dp = new SpecificationProperties();
- init(this.getClass().getName(), observe_options, args, null, dp, callback, "sm");
+ init(this.getClass().getName(), observe_options, args, null, dp, callback, target_daemon);
Pair<Integer, String> id = getId(UiOption.Observe);
String user = dp.getProperty(UiOption.User.pname());
@@ -725,7 +727,7 @@ public class DuccServiceApi
throws Exception
{
DuccProperties dp = new SpecificationProperties();
- init(this.getClass().getName(), ignore_options, args, null, dp, callback, "sm");
+ init(this.getClass().getName(), ignore_options, args, null, dp, callback, target_daemon);
Pair<Integer, String> id = getId(UiOption.Ignore);
String user = dp.getProperty(UiOption.User.pname());
@@ -746,7 +748,7 @@ public class DuccServiceApi
throws Exception
{
DuccProperties dp = new SpecificationProperties();
- init(this.getClass().getName(), enable_options, args, null, dp, callback, "sm");
+ init(this.getClass().getName(), enable_options, args, null, dp, callback, target_daemon);
Pair<Integer, String> id = getId(UiOption.Enable);
String user = dp.getProperty(UiOption.User.pname());
@@ -767,7 +769,7 @@ public class DuccServiceApi
throws Exception
{
DuccProperties dp = new SpecificationProperties();
- init(this.getClass().getName(), disable_options, args, null, dp, callback, "sm");
+ init(this.getClass().getName(), disable_options, args, null, dp, callback, target_daemon);
Pair<Integer, String> id = getId(UiOption.Disable);
String user = dp.getProperty(UiOption.User.pname());
Modified: uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/config/CommonConfiguration.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/config/CommonConfiguration.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/config/CommonConfiguration.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/config/CommonConfiguration.java Thu Mar 16 12:35:52 2017
@@ -123,6 +123,10 @@ public class CommonConfiguration {
@Value("#{ systemProperties['ducc.sm.state.update.endpoint'] }")
public String smStateUpdateEndpoint;
+ // fetch the name of an endpoint where the Service Manager should receive API requests
+ @Value("#{ systemProperties['ducc.sm.api.endpoint'] }")
+ public String smApiEndpoint;
+
// fetch the rate at which the SM should post its state
@Value("#{ systemProperties['ducc.sm.state.publish.rate'] }")
public String smStatePublishRate;
Modified: uima/uima-ducc/trunk/uima-ducc-container/src/test/resources/ducc_runtime/resources/ducc.properties
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-container/src/test/resources/ducc_runtime/resources/ducc.properties?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-container/src/test/resources/ducc_runtime/resources/ducc.properties (original)
+++ uima/uima-ducc/trunk/uima-ducc-container/src/test/resources/ducc_runtime/resources/ducc.properties Thu Mar 16 12:35:52 2017
@@ -305,9 +305,6 @@ ducc.sm.meta.ping.stability = 10
# How long to wait for a ping to respond, in milliseconds
ducc.sm.meta.ping.timeout = 15000
-# Port the CLI uses to contact SM
-ducc.sm.http.port = 19989
-
# Node where SM resides
ducc.sm.http.node = ${ducc.head}
Modified: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/config/OrchestratorConfiguration.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/config/OrchestratorConfiguration.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/config/OrchestratorConfiguration.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/config/OrchestratorConfiguration.java Thu Mar 16 12:35:52 2017
@@ -50,6 +50,8 @@ import org.apache.uima.ducc.transport.ev
import org.apache.uima.ducc.transport.event.JdReplyEvent;
import org.apache.uima.ducc.transport.event.JdRequestEvent;
import org.apache.uima.ducc.transport.event.OrchestratorStateDuccEvent;
+import org.apache.uima.ducc.transport.event.ServiceReplyEvent;
+import org.apache.uima.ducc.transport.event.ServiceRequestEvent;
import org.apache.uima.ducc.transport.event.SubmitJobDuccEvent;
import org.apache.uima.ducc.transport.event.SubmitJobReplyDuccEvent;
import org.apache.uima.ducc.transport.event.SubmitReservationDuccEvent;
@@ -220,6 +222,17 @@ public class OrchestratorConfiguration {
exchange.getIn().setBody(replyServiceEvent);
SystemEventsLogger.info(IDuccLoggerComponents.abbrv_orchestrator, cancelServiceEvent, replyServiceEvent);
}
+ // Single point of Entry (SPOE) for Services Manager (SM)
+ // - field HTTP request from CLI/API
+ // - forward to SM via AMQ queue
+ // - receive reply via AMQ
+ // - send HTTP response back to CLI/API
+ if(obj instanceof ServiceRequestEvent) {
+ ServiceRequestEvent serviceRequest = exchange.getIn().getBody(ServiceRequestEvent.class);
+ ServiceReplyEvent serviceReply = serviceRequest.getReply();
+ exchange.getIn().setBody(serviceReply);
+ SystemEventsLogger.info(IDuccLoggerComponents.abbrv_servicesManager, serviceRequest, serviceReply);
+ }
}
}
@@ -298,6 +311,8 @@ public class OrchestratorConfiguration {
// Instantiate JobManagerEventListener delegate listener. This listener will receive
// incoming messages.
OrchestratorEventListener delegateListener = this.orchestratorDelegateListener(orchestrator);
+ // direct communication exchange OR-SM
+ delegateListener.initSmChannel(common.camelContext(), common.smApiEndpoint);
// Inject a dispatcher into the listener in case it needs to send
// a message to another component
delegateListener.setDuccEventDispatcher(orchestratorTransport.duccEventDispatcher(common.pmRequestEndpoint, orchestrator.getContext()));
Modified: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/OrchestratorEventListener.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/OrchestratorEventListener.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/OrchestratorEventListener.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/OrchestratorEventListener.java Thu Mar 16 12:35:52 2017
@@ -21,6 +21,7 @@ package org.apache.uima.ducc.orchestrato
import java.util.Properties;
import org.apache.camel.Body;
+import org.apache.camel.CamelContext;
import org.apache.uima.ducc.common.internationalization.Messages;
import org.apache.uima.ducc.common.utils.DuccLogger;
import org.apache.uima.ducc.common.utils.DuccLoggerComponents;
@@ -34,6 +35,8 @@ import org.apache.uima.ducc.transport.ev
import org.apache.uima.ducc.transport.event.JdRequestEvent;
import org.apache.uima.ducc.transport.event.NodeInventoryUpdateDuccEvent;
import org.apache.uima.ducc.transport.event.RmStateDuccEvent;
+import org.apache.uima.ducc.transport.event.ServiceReplyEvent;
+import org.apache.uima.ducc.transport.event.ServiceRequestEvent;
import org.apache.uima.ducc.transport.event.SmStateDuccEvent;
import org.apache.uima.ducc.transport.event.SubmitJobDuccEvent;
import org.apache.uima.ducc.transport.event.SubmitReservationDuccEvent;
@@ -184,6 +187,25 @@ public class OrchestratorEventListener i
}
catch(Throwable t) {
logger.error(methodName, null, t);
+ }
+ logger.trace(methodName, null, messages.fetch("exit"));
+ }
+
+ private SmChannel smChannel = null;
+
+ public void initSmChannel(CamelContext context, String endpoint) {
+ smChannel = new SmChannel(context, endpoint);
+ }
+
+ public void onServiceRequestEvent(@Body ServiceRequestEvent request) throws Exception {
+ String methodName = "onServiceRequestEvent";
+ logger.trace(methodName, null, messages.fetch("enter"));
+ try {
+ ServiceReplyEvent reply = smChannel.exchange(request);
+ request.setReply(reply);
+ }
+ catch(Throwable t) {
+ logger.error(methodName, null, t);
}
logger.trace(methodName, null, messages.fetch("exit"));
}
Added: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/SmChannel.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/SmChannel.java?rev=1787171&view=auto
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/SmChannel.java (added)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/SmChannel.java Thu Mar 16 12:35:52 2017
@@ -0,0 +1,44 @@
+/*
+ * 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.
+*/
+package org.apache.uima.ducc.orchestrator.event;
+
+import org.apache.camel.CamelContext;
+import org.apache.uima.ducc.transport.dispatcher.DuccEventDispatcher;
+import org.apache.uima.ducc.transport.event.DuccEvent;
+import org.apache.uima.ducc.transport.event.ServiceReplyEvent;
+import org.apache.uima.ducc.transport.event.ServiceRequestEvent;
+
+/*
+ * Class for OR <--> SM communication to support SM's CLI/API via single point of entry.
+ */
+public class SmChannel extends DuccEventDispatcher {
+
+ public SmChannel(CamelContext context, String endpoint) {
+ super(context, endpoint);
+ }
+
+ /*
+ * forward the CLI/API request to SM and get the reply
+ */
+ public ServiceReplyEvent exchange(ServiceRequestEvent request) throws Exception {
+ DuccEvent duccEvent = dispatchAndWaitForDuccReply(request);
+ ServiceReplyEvent reply = (ServiceReplyEvent) duccEvent;
+ return reply;
+ }
+}
Propchange: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/SmChannel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/event/SmChannel.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/system/events/log/SystemEventsLogger.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/system/events/log/SystemEventsLogger.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/system/events/log/SystemEventsLogger.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/system/events/log/SystemEventsLogger.java Thu Mar 16 12:35:52 2017
@@ -12,6 +12,8 @@ import org.apache.uima.ducc.transport.ev
import org.apache.uima.ducc.transport.event.CancelReservationReplyDuccEvent;
import org.apache.uima.ducc.transport.event.CancelServiceDuccEvent;
import org.apache.uima.ducc.transport.event.CancelServiceReplyDuccEvent;
+import org.apache.uima.ducc.transport.event.ServiceReplyEvent;
+import org.apache.uima.ducc.transport.event.ServiceRequestEvent;
import org.apache.uima.ducc.transport.event.SubmitJobDuccEvent;
import org.apache.uima.ducc.transport.event.SubmitJobReplyDuccEvent;
import org.apache.uima.ducc.transport.event.SubmitReservationDuccEvent;
@@ -202,4 +204,17 @@ public class SystemEventsLogger {
duccLogger.event_info(daemon, user, type, event);
}
+ /*
+ * log a services request
+ */
+ public static void info(String daemon, ServiceRequestEvent request, ServiceReplyEvent response) {
+ String user = request.getUser();
+ String type = request.getEventType().name();
+ long id = response.getId();
+ boolean rc = response.getReturnCode();
+ String message = response.getMessage();
+ Object[] event = { "id:"+id, "rc:"+rc, message};
+ duccLogger.event_info(daemon, user, type, event);
+ }
+
}
Modified: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/test/resources/ducc_runtime/resources/ducc.properties
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/test/resources/ducc_runtime/resources/ducc.properties?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/test/resources/ducc_runtime/resources/ducc.properties (original)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/test/resources/ducc_runtime/resources/ducc.properties Thu Mar 16 12:35:52 2017
@@ -290,9 +290,6 @@ ducc.sm.meta.ping.stability = 10
# How long to wait for a ping to respond, in milliseconds
ducc.sm.meta.ping.timeout = 15000
-# Port the CLI uses to contact SM
-ducc.sm.http.port = 19989
-
# Node where SM resides
ducc.sm.http.node = ${ducc.head}
Modified: uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/config/ServiceManagerConfiguration.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/config/ServiceManagerConfiguration.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/config/ServiceManagerConfiguration.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/config/ServiceManagerConfiguration.java Thu Mar 16 12:35:52 2017
@@ -18,15 +18,15 @@
*/
package org.apache.uima.ducc.sm.config;
-import org.apache.camel.CamelContext;
+import javax.jms.Destination;
+
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jetty9.JettyHttpComponent9;
import org.apache.uima.ducc.common.config.CommonConfiguration;
-import org.apache.uima.ducc.common.exception.DuccRuntimeException;
import org.apache.uima.ducc.common.utils.DuccLogger;
import org.apache.uima.ducc.common.utils.XStreamUtils;
+import org.apache.uima.ducc.common.utils.id.DuccId;
import org.apache.uima.ducc.sm.ServiceManagerComponent;
import org.apache.uima.ducc.sm.event.ServiceManagerEventListener;
import org.apache.uima.ducc.transport.DuccTransportConfiguration;
@@ -53,7 +53,7 @@ public class ServiceManagerConfiguration
@Autowired DuccTransportConfiguration serviceManagerTransport;
private DuccLogger logger = DuccLogger.getLogger(this.getClass(), "SM");
-
+ private static DuccId jobid = null;
/**
* Instantiate {@link ServiceManagerEventListener} which will handle incoming messages.
@@ -95,7 +95,6 @@ public class ServiceManagerConfiguration
* @param delegate - {@link ServiceManagerEventListener} instance
* @return - initialized {@link RouteBuilder} instance
*/
- /*
public synchronized RouteBuilder routeBuilderForApi(final String endpoint, final ServiceManagerEventListener delegate)
{
@@ -110,28 +109,6 @@ public class ServiceManagerConfiguration
}
};
}
-*/
- private RouteBuilder routeBuilderForJetty(final CamelContext context, final ServiceManagerEventListener delegate) throws Exception {
-
- return new RouteBuilder() {
- public void configure() {
-
- JettyHttpComponent9 jettyComponent = new JettyHttpComponent9();
- String port = System.getProperty("ducc.sm.http.port");
- //ExchangeMonitor xmError = new ExchangeMonitor(LifeStatus.Error, ExchangeType.Receive);
-
- context.addComponent("jetty", jettyComponent);
- onException(Throwable.class).maximumRedeliveries(0).handled(false).process(new ErrorProcessor());
-
- from("jetty://http://0.0.0.0:" + port + "/sm")
- .unmarshal().xstream()
- .bean(delegate)
- .process(new SmReplyProcessor()) // inject reply object
- .process(new JettyReplyProcessor()) // translate to http response
- ;
- }
- };
- }
private class SmReplyProcessor implements Processor {
@@ -152,25 +129,6 @@ public class ServiceManagerConfiguration
}
}
- private class JettyReplyProcessor
- implements Processor
- {
- public void process(Exchange exchange) throws Exception
- {
- exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 200);
- exchange.getOut().setHeader("content-type", "text/xml");
- Object o = exchange.getIn().getBody();
- if ( o != null ) {
- String body = XStreamUtils.marshall(o);
- exchange.getOut().setBody(body);
- exchange.getOut().setHeader("content-length", body.length());
- } else {
- logger.warn("RouteBuilder.configure", null, new DuccRuntimeException("No reply object was provided."));
- exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 500);
- }
- }
- }
-
public class ErrorProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
@@ -194,9 +152,12 @@ public class ServiceManagerConfiguration
public class TransportProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
-// System.out.println("... SM transport received Event. Body Type:"+exchange.getIn().getBody().getClass().getName());
-// Destination replyTo = exchange.getIn().getHeader("JMSReplyTo", Destination.class);
-// System.out.println("... transport - value of replyTo:" + replyTo);
+ String location = "process";
+ String text = "... SM transport received Event. Body Type:"+exchange.getIn().getBody().getClass().getName();
+ logger.debug(location, jobid, text);
+ Destination replyTo = exchange.getIn().getHeader("JMSReplyTo", Destination.class);
+ text = "... transport - value of replyTo:" + replyTo;
+ logger.debug(location, jobid, text);
}
}
@@ -269,10 +230,8 @@ public class ServiceManagerConfiguration
common.smStateUpdateEndpoint);
// OR state messages - incoming
sm.getContext().addRoutes(this.routeBuilderForIncomingRequests(common.orchestratorStateUpdateEndpoint, delegateListener));
-
- // API requests - incoming
- //sm.getContext().addRoutes(this.routeBuilderForApi(common.smRequestEndpoint, delegateListener));
- sm.getContext().addRoutes(this.routeBuilderForJetty(sm.getContext(), delegateListener));
+ // API requests - incoming (via OR)
+ sm.getContext().addRoutes(this.routeBuilderForApi(common.smApiEndpoint, delegateListener));
// TODO Not used - timer to send state. We now send whenever we get an OR heartbeat.
//sm.getContext().addRoutes(this.routeBuilderForSMStatePost(sm, common.smStateUpdateEndpoint, Integer.parseInt(common.smStatePublishRate)));
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/dispatcher/DuccEventDispatcher.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/dispatcher/DuccEventDispatcher.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/dispatcher/DuccEventDispatcher.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/dispatcher/DuccEventDispatcher.java Thu Mar 16 12:35:52 2017
@@ -24,21 +24,22 @@ import org.apache.camel.CamelContext;
import org.apache.camel.ExchangePattern;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.RuntimeExchangeException;
-import org.apache.camel.dataformat.xstream.XStreamDataFormat;
-import org.apache.camel.impl.DefaultClassResolver;
import org.apache.uima.ducc.common.exception.DuccRuntimeException;
+import org.apache.uima.ducc.common.utils.DuccLogger;
+import org.apache.uima.ducc.common.utils.id.DuccId;
import org.apache.uima.ducc.transport.DuccExchange;
import org.apache.uima.ducc.transport.event.DuccEvent;
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.DomDriver;
-
public class DuccEventDispatcher {
+
+ private static DuccLogger logger = new DuccLogger(DuccEventDispatcher.class);
+ private static DuccId jobid = null;
+
private ProducerTemplate pt;
private String targetEndpoint;
- CamelContext context;
+ protected CamelContext context;
public DuccEventDispatcher(CamelContext context) {
this.pt = context.createProducerTemplate();
@@ -49,30 +50,7 @@ public class DuccEventDispatcher {
this.context = context;
this.targetEndpoint = targetEndpoint;
}
-
- private String marshallDuccEvent(DuccEvent duccEvent) throws Exception {
- XStreamDataFormat xStreamDataFormat = new XStreamDataFormat();
- XStream xStream = xStreamDataFormat.getXStream(new DefaultClassResolver());
- return xStream.toXML(duccEvent);
- }
-
- private DuccEvent unmarshallDuccEvent(Object targetToUnmarshall) throws Exception {
- XStream xStream = new XStream(new DomDriver());
- String claz = targetToUnmarshall.getClass().getName();
- if (targetToUnmarshall instanceof byte[]) {
- Object reply = xStream.fromXML(new String((byte[]) targetToUnmarshall));
- if (reply instanceof DuccEvent) {
- return (DuccEvent) reply;
- } else {
- claz = (reply == null) ? "NULL" : reply.getClass().getName();
- }
- }
- throw new Exception(
- "Unexpected Reply type received from Ducc Component. Expected DuccEvent, instead received:"
- + claz);
-
- }
-
+
public void dispatch(int serviceSocketPort, DuccEvent duccEvent) throws Exception {
// by default Mina doesnt include exchange.The transferExchange=true forces inclusion of the Exchange in
// a message
@@ -90,23 +68,16 @@ public class DuccEventDispatcher {
}
public void dispatch(String endpoint, DuccEvent duccEvent, String nodeList) throws Exception {
- try {
-// XStreamDataFormat xStreamDataFormat = new XStreamDataFormat();
-// XStream xStream = xStreamDataFormat.getXStream(new DefaultClassResolver());
-
-// String marshalledEvent = xStream.toXML(duccEvent);
-
+ String location = "dispatch";
+ try {
if (nodeList != null) {
// No reply is expected
-// pt.sendBodyAndHeader(endpoint, marshalledEvent, DuccExchange.TARGET_NODES_HEADER_NAME,
- pt.sendBodyAndHeader(endpoint, duccEvent, DuccExchange.TARGET_NODES_HEADER_NAME,
- nodeList);
+ pt.sendBodyAndHeader(endpoint, duccEvent, DuccExchange.TARGET_NODES_HEADER_NAME, nodeList);
} else {
-// pt.asyncRequestBody(endpoint, marshalledEvent);
pt.asyncRequestBody(endpoint, duccEvent);
}
} catch (Exception e) {
- e.printStackTrace();
+ logger.error(location, jobid, e);
}
}
@@ -134,7 +105,7 @@ public class DuccEventDispatcher {
public DuccEvent dispatchAndWaitForDuccReply(DuccEvent duccEvent) throws Exception {
int maxRetryCount = 20;
int i = 0;
- Object reply = null;
+ Object response = null;
RuntimeExchangeException ree = null;
// retry up to 20 times. This is an attempt to handle an error thrown
@@ -143,7 +114,7 @@ public class DuccEventDispatcher {
// After 10secs Camel times out and throws an Exception.
for (; i < maxRetryCount; i++) {
try {
- reply = pt.sendBody(targetEndpoint, ExchangePattern.InOut, marshallDuccEvent(duccEvent));
+ response = pt.sendBody(targetEndpoint, ExchangePattern.InOut, duccEvent);
ree = null; // all is well - got a reply
break; // done here
@@ -163,7 +134,8 @@ public class DuccEventDispatcher {
"ActiveMQ failed to create temp reply queue. After 20 attempts to deliver request to the OR, Ducc JMS Dispatcher is giving up.",
ree);
}
- return unmarshallDuccEvent(reply);
+ DuccEvent reply = (DuccEvent) response;
+ return reply;
}
public void stop() throws Exception {
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceDisableEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceDisableEvent.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceDisableEvent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceDisableEvent.java Thu Mar 16 12:35:52 2017
@@ -21,7 +21,7 @@ package org.apache.uima.ducc.transport.e
@SuppressWarnings("serial")
public class ServiceDisableEvent
- extends AServiceRequest
+ extends ServiceRequestEvent
{
private long friendly;
private String epname;
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceEnableEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceEnableEvent.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceEnableEvent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceEnableEvent.java Thu Mar 16 12:35:52 2017
@@ -21,7 +21,7 @@ package org.apache.uima.ducc.transport.e
@SuppressWarnings("serial")
public class ServiceEnableEvent
- extends AServiceRequest
+ extends ServiceRequestEvent
{
private long friendly;
private String epname;
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceIgnoreEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceIgnoreEvent.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceIgnoreEvent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceIgnoreEvent.java Thu Mar 16 12:35:52 2017
@@ -21,7 +21,7 @@ package org.apache.uima.ducc.transport.e
@SuppressWarnings("serial")
public class ServiceIgnoreEvent
- extends AServiceRequest
+ extends ServiceRequestEvent
{
private long friendly;
private String epname;
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceModifyEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceModifyEvent.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceModifyEvent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceModifyEvent.java Thu Mar 16 12:35:52 2017
@@ -22,7 +22,7 @@ import org.apache.uima.ducc.common.utils
@SuppressWarnings("serial")
public class ServiceModifyEvent
- extends AServiceRequest
+ extends ServiceRequestEvent
{
private long friendly; // the "friendly" part of a DuccId
private String epname;
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceObserveEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceObserveEvent.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceObserveEvent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceObserveEvent.java Thu Mar 16 12:35:52 2017
@@ -21,7 +21,7 @@ package org.apache.uima.ducc.transport.e
@SuppressWarnings("serial")
public class ServiceObserveEvent
- extends AServiceRequest
+ extends ServiceRequestEvent
{
private long friendly;
private String epname;
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceQueryEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceQueryEvent.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceQueryEvent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceQueryEvent.java Thu Mar 16 12:35:52 2017
@@ -20,7 +20,7 @@ package org.apache.uima.ducc.transport.e
@SuppressWarnings("serial")
public class ServiceQueryEvent
- extends AServiceRequest
+ extends ServiceRequestEvent
{
long friendly;
String epname;
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRegisterEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRegisterEvent.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRegisterEvent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRegisterEvent.java Thu Mar 16 12:35:52 2017
@@ -23,7 +23,7 @@ import org.apache.uima.ducc.transport.ev
@SuppressWarnings("serial")
public class ServiceRegisterEvent
- extends AServiceRequest
+ extends ServiceRequestEvent
{
private int ninstances;
Added: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRequestEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRequestEvent.java?rev=1787171&view=auto
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRequestEvent.java (added)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRequestEvent.java Thu Mar 16 12:35:52 2017
@@ -0,0 +1,30 @@
+/*
+ * 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.
+*/
+package org.apache.uima.ducc.transport.event;
+
+public class ServiceRequestEvent
+extends AServiceRequest
+{
+ private static final long serialVersionUID = 1L;
+
+ public ServiceRequestEvent(EventType eventType, String user, byte[] auth_block, int cli_version) {
+ super(eventType, user, auth_block, cli_version);
+ }
+
+}
Propchange: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRequestEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceRequestEvent.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceStartEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceStartEvent.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceStartEvent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceStartEvent.java Thu Mar 16 12:35:52 2017
@@ -20,7 +20,7 @@ package org.apache.uima.ducc.transport.e
@SuppressWarnings("serial")
public class ServiceStartEvent
- extends AServiceRequest
+ extends ServiceRequestEvent
{
private int friendly;
private String epname;
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceStopEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceStopEvent.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceStopEvent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceStopEvent.java Thu Mar 16 12:35:52 2017
@@ -21,7 +21,7 @@ package org.apache.uima.ducc.transport.e
@SuppressWarnings("serial")
public class ServiceStopEvent
- extends AServiceRequest
+ extends ServiceRequestEvent
{
private long friendly;
private String epname;
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceUnregisterEvent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceUnregisterEvent.java?rev=1787171&r1=1787170&r2=1787171&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceUnregisterEvent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/ServiceUnregisterEvent.java Thu Mar 16 12:35:52 2017
@@ -20,7 +20,7 @@ package org.apache.uima.ducc.transport.e
@SuppressWarnings("serial")
public class ServiceUnregisterEvent
- extends AServiceRequest
+ extends ServiceRequestEvent
{
private long friendly;