diff options
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs')
5 files changed, 174 insertions, 0 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ct-websocket-io.adoc b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ct-websocket-io.adoc new file mode 100644 index 000000000..8a19cdd32 --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ct-websocket-io.adoc @@ -0,0 +1,75 @@ +// +// ============LICENSE_START======================================================= +// Copyright (C) 2016-2018 Ericsson. All rights reserved. +// ================================================================================ +// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE +// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode +// +// SPDX-License-Identifier: CC-BY-4.0 +// ============LICENSE_END========================================================= +// +// @author Sven van der Meer (sven.van.der.meer@ericsson.com) +// + +== Websocket (WS) IO + +APEX supports the Websockets as input as well as output. +WS IO is supported by the APEX Websocket plugin. +This carrier technology does only support uni-directional communication. +APEX will not send events to a Websocket input and any event sent to a Websocket output will result in an error log. + +The input can be configured as client (APEX connects to an existing Websocket server) or server (APEX starts a Websocket server). +The same applies to the output. +Input and output can both use a client or a server configuration, or separate configurations (input as client and output as server, input as server and output as client). +Each configuration should use its own dedicated port to avoid any communication loops. +The configuration of a Websocket client is the same for input and output. +The configuration of a Websocket server is the same for input and output. + + +=== Websocket Client + +APEX will connect to a given Websocket server. +As input, it will receive events from the server but not send any events. +As output, it will send events to the server and any event received from the server will result in an error log. + +[source%nowrap,json] +---- +"carrierTechnologyParameters" : { + "carrierTechnology" : "WEBSOCKET", <1> + "parameterClassName" : + "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameters" : { + "host" : "localhost", <2> + "port" : 42451 <3> + } +} +---- + +<1> set Websocket as carrier technology +<2> the host name on which a Websocket server is running +<3> the port of that Websocket server + + + +=== Websocket Server + +APEX will start a Websocket server, which will accept any Websocket clients to connect. +As input, it will receive events from the server but not send any events. +As output, it will send events to the server and any event received from the server will result in an error log. + +[source%nowrap,json] +---- +"carrierTechnologyParameters" : { + "carrierTechnology" : "WEBSOCKET", <1> + "parameterClassName" : + "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameters" : { + "wsClient" : false, <2> + "port" : 42450 <3> + } +} +---- + +<1> set Websocket as carrier technology +<2> disable client, so that APEX will start a Websocket server +<3> the port for the Websocket server APEX will start diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/engine-config-bcp.adoc b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/engine-config-bcp.adoc new file mode 100644 index 000000000..227cc45bb --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/engine-config-bcp.adoc @@ -0,0 +1,29 @@ +// +// ============LICENSE_START======================================================= +// Copyright (C) 2016-2018 Ericsson. All rights reserved. +// ================================================================================ +// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE +// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode +// +// SPDX-License-Identifier: CC-BY-4.0 +// ============LICENSE_END========================================================= +// +// @author Sven van der Meer (sven.van.der.meer@ericsson.com) +// + +== BCP: Websocket Configuration + +The probably best is to configure APEX for Websocket servers for input (ingress, consume) and output (egress, produce) interfaces. +This means that APEX will start Websocket servers on named ports and wait for clients to connect. +Advantage: once APEX is running all connectivity infrastructure is running as well. +Consequence: if APEX is not running, everyone else is in the dark, too. + +The best protocol to be used is JSON string. +Each event on any interface is then a string with a JSON encoding. +JSON string is a little bit slower than byte code, but we doubt that this will be noticeable. +A further advantage of JSON strings over Websockets with APEX starting the servers: it is very easy to connect web browsers to such a system. +Simple connect the web browser to the APEX sockets and send/read JSON strings. + +Once APEX is started you simply connect Websocket clients to it, and send/receive event. +When APEX is terminated, the Websocket servers go down, and the clients will be disconnected. +APEX does not (yet) support auto-client reconnect nor WAMP, so clients might need to be restarted or reconnected manually after an APEX boot. diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ws-foss.adoc b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ws-foss.adoc new file mode 100644 index 000000000..43c6f247e --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ws-foss.adoc @@ -0,0 +1,27 @@ +// +// ============LICENSE_START======================================================= +// Copyright (C) 2016-2018 Ericsson. All rights reserved. +// ================================================================================ +// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE +// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode +// +// SPDX-License-Identifier: CC-BY-4.0 +// ============LICENSE_END========================================================= +// +// @author Sven van der Meer (sven.van.der.meer@ericsson.com) +// + +== Websocket Example Code for Websocket clients (FOSS) + +There are a lot of implementations and examples available on Github for Websocket clients. +If one is using Java EE 7, then one can also use the native Websocket implementation. +Good examples for clients using simply Java SE are here: + +- link:https://github.com/TooTallNate/Java-WebSocket[Websocket implementation] +- link:https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/ChatClient.java[Websocket sending client example, using AWT] +- link:https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/ExampleClient.java[Websocket receiving client example (simple echo client)] + +For Java EE, the native Websocket API is explained here: + +- link:http://www.oracle.com/technetwork/articles/java/jsr356-1937161.html[Oracle docs] +- link: http://www.programmingforliving.com/2013/08/jsr-356-java-api-for-websocket-client-api.html[An example] diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ws-intro.adoc b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ws-intro.adoc new file mode 100644 index 000000000..cbecbbe7f --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ws-intro.adoc @@ -0,0 +1,23 @@ +// +// ============LICENSE_START======================================================= +// Copyright (C) 2016-2018 Ericsson. All rights reserved. +// ================================================================================ +// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE +// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode +// +// SPDX-License-Identifier: CC-BY-4.0 +// ============LICENSE_END========================================================= +// +// @author Sven van der Meer (sven.van.der.meer@ericsson.com) +// + +== Websockets + +Websocket is a protocol to run sockets of HTTP. +Since it in essence a socket, the connection is realized between a server (waiting for connections) and a client (connecting to a server). +Server/client separation is only important for connection establishment, once connected, everyone can send/receive on the same socket (as any standard socket would allow). + +Standard Websocket implementations are simple, no publish/subscribe and no special event handling. +Most servers simply send all incoming messages to all connections. +There is a PubSub definition on top of Websocket called link:http://wamp-proto.org/[WAMP]. +APEX does not support WAMP at the moment. diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ws-java.adoc b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ws-java.adoc new file mode 100644 index 000000000..e6c2c0163 --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ws-java.adoc @@ -0,0 +1,20 @@ +// +// ============LICENSE_START======================================================= +// Copyright (C) 2016-2018 Ericsson. All rights reserved. +// ================================================================================ +// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE +// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode +// +// SPDX-License-Identifier: CC-BY-4.0 +// ============LICENSE_END========================================================= +// +// @author Sven van der Meer (sven.van.der.meer@ericsson.com) +// + +== Websocket in Java + +In Java, link:http://www.oracle.com/technetwork/articles/java/jsr356-1937161.html[JSR 356] defines the standard Websocket API. +This JSR is part of Jave EE 7 standard. +For Java SE, several implementations exist in open source. +Since Websockets are a stable standard and simple, most implementations are stable and ready to use. +A lot of products support Websockets, like Spring, JBoss, Netty, … there are also Kafka extensions for Websockets. |