You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by cc...@apache.org on 2009/10/22 17:29:47 UTC
svn commit: r828745 - in /servicemix/smx4/nmr/trunk/examples:
interceptors/README.txt interceptors/endpoint/README.txt
interceptors/exchange/README.txt nmr/README.txt
Author: ccustine
Date: Thu Oct 22 15:29:47 2009
New Revision: 828745
URL: http://svn.apache.org/viewvc?rev=828745&view=rev
Log:
SMX4-404 - Updates to ServiceMix example readmes
Added:
servicemix/smx4/nmr/trunk/examples/interceptors/README.txt
Modified:
servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/README.txt
servicemix/smx4/nmr/trunk/examples/interceptors/exchange/README.txt
servicemix/smx4/nmr/trunk/examples/nmr/README.txt
Added: servicemix/smx4/nmr/trunk/examples/interceptors/README.txt
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/examples/interceptors/README.txt?rev=828745&view=auto
==============================================================================
--- servicemix/smx4/nmr/trunk/examples/interceptors/README.txt (added)
+++ servicemix/smx4/nmr/trunk/examples/interceptors/README.txt Thu Oct 22 15:29:47 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+INTERCEPTORS EXAMPLES
+=====================
+
+The interceptors example folder contains two interceptor examples:
+
+1. A custom endpoint listener example (see the /endpoint directory),
+ which shows you how to develop and deploy a custom endpoint
+ listener that captures and reports, to the ServiceMix
+ log, when an endpoint registers and unregisters with the NMR.
+
+ For more information on how to run this example, see the
+ README.txt file in the /endpoint directory.
+
+2. A custom exchange listener example (see the /exchange directory),
+ which shows you how to develop and deploy a custom exchange
+ listener that captures and reports, to the ServiceMix log, the
+ exchanges that are sent and delivered in the NMR.
+
+ For more information on how to run this example, see the
+ README.txt file in the /exchange directory.
Modified: servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/README.txt
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/README.txt?rev=828745&r1=828744&r2=828745&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/README.txt (original)
+++ servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/README.txt Thu Oct 22 15:29:47 2009
@@ -15,31 +15,126 @@
* limitations under the License.
*/
-Welcome to the ServiceMix Custom Endpoint Listener Example
-==========================================================
+CUSTOM ENDPOINT LISTENER EXAMPLE
+================================
+
+Purpose
+-------
+Develop and deploy a custom endpoint listener that captures and
+reports, to the ServiceMix log, when an endpoint registers and
+unregisters with the NMR.
+
+
+Explanation
+-----------
+The custom endpoint listener is written in Java. See the
+CustomEndpointListener.java file located in the following directory
+of this example:
+
+ src/main/java/org/apache/servicemix/nmr/examples/interceptors/endpoint
+
+It uses the NMR event API, which can be used to receive notifications
+about what is happening in the NMR. In particular, it implements the
+EndpointListener interface, which listens and receives events when an
+endpoint is registered or unregistered with the NMR. It has two methods:
+
+ - endpointRegistered: Captures endpoint registration events.
+
+ - endpointUnregistered: Captures events when an endpoint unregisters.
+
+The custom endpoint listener is configured in a beans.xml Spring file,
+which registers the custom endpoint listener as an OSGi service. The
+beans.xml file is located in the src/main/resources/META-INF/spring
+directory of this example.
+
+
+Prerequisites for Building and Running the Example
+--------------------------------------------------
+1. You must have the following installed on your machine:
+
+ - JDK 1.5 or higher
+
+ - Maven 2.0.9 or higher (for building)
+
+ For more information, see the README in the top-level
+ examples directory.
+
+2. Start ServiceMix by running the following command:
+
+ <servicemix_home>/bin/servicemix (on UNIX)
+ <servicemix_home>\bin\servicemix (on Windows)
-Quick steps to install this example
--------------------------------------
-Launch the container by running
- bin/servicemix, bin/nmr or bin/karaf
-in the root dir of this distribution.
+Building and Deploying
+----------------------
+To build this example, run the following command (from the directory
+that contains this README):
-run:
mvn install
+
+If all of the required OSGi bundles are available in your local
+Maven repository, the example will build quickly. Otherwise it
+may take some time for Maven to download everything it needs.
+
+Once complete, you will find the example JAR file,
+endpoint-${version}.jar, in the target directory of this example.
+
+You can deploy the example in two ways:
+
+- Using Hot Deployment
+ --------------------
+
+ Copy the target/endpoint-${version}.zip to the
+ <servicemix_home>/deploy directory.
+
+
+- Using the ServiceMix Console
+ ----------------------------
+
+ Enter the following command:
+
+ osgi:install -s mvn:org.apache.servicemix.nmr.examples.interceptors/endpoint/${version}/jar
+
+Once the bundle is installed, the listener is automatically started.
+The next time an endpoint registers or unregisters with the NMR, you
+should see an entry in the log file in the data/log directory of your
+ServiceMix installation. Look for CustomEndpointListener entries.
+For example, if you install and uninstall the NMR example (see the
+examples/nmr directory), you should see output similar to following
+appearing in the log file:
+
+14:25:36,630 | INFO | xtenderThread-62 | CustomEndpointListener | .endpoint.CustomEndpointListener 41 | Endpoint Registered: ID: 02c4a67d-20f5-4066-95ce-fdd454735b8f Meta-Data: {Bundle-SymbolicName=org.apache.servicemix.nmr.examples.nmr.endpoint, Bundle-Version=1.1.0.2-fuse, NAME=EchoEndpoint, objectClass=[Ljava.lang.String;@3e03b3, org.springframework.osgi.bean.name=echo, service.id=227}
+
+
+14:25:50,208 | INFO | Timer-1 | CustomEndpointListener | .endpoint.CustomEndpointListener 51 | Endpoint Unregistered: ID: 02c4a67d-20f5-4066-95ce-fdd454735b8f Meta-Data: {Bundle-SymbolicName=org.apache.servicemix.nmr.examples.nmr.endpoint, Bundle-Version=1.1.0.2-fuse, NAME=EchoEndpoint, objectClass=[Ljava.lang.String;@3e03b3, org.springframework.osgi.bean.name=echo, service.id=227}
+
+
+Stopping and Uninstalling the Example
+-------------------------------------
+To stop or uninstall the example, you must first know the bundle
+ID that ServiceMix has assigned to it. To get the bundle ID, enter
+the following command at the ServiceMix console:
+
+ osgi:list
-Deploy the example on ServiceMix 4:
+At the end of the listing, you should see an entry similar to the
+following:
-- using the ServiceMix console:
- osgi:install -s mvn:org.apache.servicemix.nmr.examples.interceptors/endpoint/${version}/jar
+[ 192] [Active ] [ ] [Started] [ 60] Apache ServiceMix NMR Example:: Endpoint Listener (1.1.0.2)
-Once the bundle is installed it will capture and report to the servicemix
-log the endpoint register and unregister events in the NMR.
+In this case, the bundle ID is 192.
-Starting and Stopping the Listener:
+To stop the example, enter the following command at the ServiceMix
+console:
-- using the ServiceMix console:
- osgi:start BundleID
- osgi:stop BundleID
+ osgi:stop <bundle_id>
-Note: Upon installation the Listener will automatically be started.
+To uninstall the example, enter the following command in the
+ServiceMix console:
+
+ osgi:uninstall <bundle_id>
+
+Changing the Example
+--------------------
+If you want to change the code or configuration, just use 'mvn install'
+to rebuild the deployment bundle, and deploy it as before.
\ No newline at end of file
Modified: servicemix/smx4/nmr/trunk/examples/interceptors/exchange/README.txt
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/examples/interceptors/exchange/README.txt?rev=828745&r1=828744&r2=828745&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/examples/interceptors/exchange/README.txt (original)
+++ servicemix/smx4/nmr/trunk/examples/interceptors/exchange/README.txt Thu Oct 22 15:29:47 2009
@@ -15,31 +15,142 @@
* limitations under the License.
*/
-Welcome to the ServiceMix Custom Exchange Listener Example
-==========================================================
+CUSTOM EXCHANGE LISTENER EXAMPLE
+================================
-Quick steps to install this example
--------------------------------------
+Purpose
+-------
+Develop and deploy a custom exchange listener that captures
+and reports, to the ServiceMix log, the exchanges that are
+sent and delivered using the NMR.
+
+
+Explanation
+-----------
+The custom exchange listener is written in Java. See the
+CustomExchangeListener.java file located in the following
+directory of this example:
+
+ src/main/java/org/apache/servicemix/nmr/examples/interceptors/exchange
+
+It uses the NMR event API, which can be used to receive notifications
+about what is happening in the NMR. In particular, it implements the
+EndpointExchange interface, which is called each time an exchange is
+sent and delivered to an endpoint.
+It has three methods:
+
+ - exchangeSent: Called each time an exchange is sent.
+
+ - exchangeDelivered: Called each time an exchange is delivered.
+
+ - exchangeFailed: Called when an exchange results in an exception
+ being thrown and an exchange is not delivered.
+
+The custom exchange listener is configured in a beans.xml Spring file,
+which registers the custom exchange listener as an OSGi service. The
+beans.xml file is located in the src/main/resources/META-INF/spring
+directory of this example.
+
+
+Prerequisites for Building and Running the Example
+--------------------------------------------------
+1. You must have the following installed on your machine:
+
+ - JDK 1.5 or higher
+
+ - Maven 2.0.9 or higher (for building)
+
+ For more information, see the README in the top-level
+ examples directory.
+
+
+2. Start ServiceMix by running the following command:
+
+ <servicemix_home>/bin/servicemix (on UNIX)
+ <servicemix_home>\bin\servicemix (on Windows)
-Launch the container by running
- bin/servicemix, bin/nmr or bin/karaf
-in the root dir of this distribution.
-run:
+Building and Deploying
+----------------------
+To build this example, run the following command (from the directory
+that contains this README):
+
mvn install
+
+If all of the required OSGi bundles are available in your local
+Maven repository, the example will build quickly. Otherwise it
+may take some time for Maven to download everything it needs.
+
+Once complete, you will find the example JAR file,
+exchange-${version}.jar, in the target directory of this
+example.
+
+You can deploy the example in two ways:
+
+- Using Hot Deployment
+ --------------------
+
+ Copy the target/exchange-${version}.zip to the
+ <servicemix_home>/deploy directory.
-Deploy the example on ServiceMix 4:
-- using the ServiceMix console:
+- Using the ServiceMix Console
+ ----------------------------
+
+ Enter the following command:
+
osgi:install -s mvn:org.apache.servicemix.nmr.examples.interceptors/exchange/${version}/jar
-Once the bundle is installed it will capture and report to the servicemix
-log the sent and delivered exchanges in the NMR.
-Starting and Stopping the Listener:
+Once the bundle is installed, the listener is automatically started.
+The next time an exchange is sent and delivered using the NMR, you
+should see an entry in the log file in the data/log directory of your
+ServiceMix installation. Look for CustomExchangeListener entries.
+For example, if you run the NMR example (see the examples/nmr directory),
+you should see output similar to following appearing in the log file:
+
+13:59:18,560 | INFO | ndpoint-thread-1 | CustomExchangeListener | .exchange.CustomExchangeListener 28 | Sending exchange: [
+ id: 954b56e6-7053-4ecd-9015-3d283506fab0
+ mep: InOut
+ status: Active
+ role: Provider
+ target: PropertyMatchingReference[{NAME=EchoEndpoint}]
+ In: [
+ content: Hello
+ ]
+ Out: [
+ content: EchoHello
+ ]
+]
+
+
+Stopping and Uninstalling the Example
+-------------------------------------
+To stop or uninstall the example, you must first know the bundle ID
+that ServiceMix has assigned to it. To get the bundle ID, enter
+the following command at the ServiceMix console:
+
+ osgi:list
+
+At the end of the listing, you should see an entry similar to the
+following:
+
+[ 203] [Active ] [ ] [Started] [ 60] Apache ServiceMix NMR Example:: Exchange Listener (1.1.0.2-fuse)
+
+In this case, the bundle ID is 203.
+
+To stop the example, enter the following command at the ServiceMix
+console:
+
+ osgi:stop <bundle_id>
+
+To uninstall the example, enter the following command in
+the ServiceMix console:
+
+ osgi:uninstall <bundle_id>
-- using the ServiceMix console:
- osgi:start BundleID
- osgi:stop BundleID
-Note: Upon installation the Listener will automatically be started.
+Changing the Example
+--------------------
+If you want to change the code or configuration, just use 'mvn install'
+to rebuild the deployment bundle, and deploy it as before.
\ No newline at end of file
Modified: servicemix/smx4/nmr/trunk/examples/nmr/README.txt
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/examples/nmr/README.txt?rev=828745&r1=828744&r2=828745&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/examples/nmr/README.txt (original)
+++ servicemix/smx4/nmr/trunk/examples/nmr/README.txt Thu Oct 22 15:29:47 2009
@@ -15,44 +15,181 @@
* limitations under the License.
*/
-Welcome to the ServiceMix NMR nmr example
-==========================================
+NMR EXAMPLE
+===========
-This example include two bundles.
-The endpoint bundle shows how to write a
-simple NMR endpoint, a osgi spring configuration file appended with this
-bundle to demostrate how to expose the Endpoint service in this bundle. The
-endpoint bundle include one java class EchoEndpoint, it simply print out the
-received exchange and add "Echo" prefix then send the exchange back.
-The client bundle shows how to access the NMR and send exhanges, also there is
-an osgi spring configuration file with this bundle to show how NMR get injected
-from OSGI service.
-
-Quick steps to install the sample
----------------------------------
-cd this example folder
-mvn install
-Launch the container by running
- bin/servicemix, bin/nmr or bin/karaf
-in the root dir of this distribution.
+Purpose
+-------
+Write and expose a simple NMR endpoint.
-When inside the console, just run the following commands to install the
-example:
- features:install examples-nmr
+Explanation
+-----------
+This example consists of:
-If you have all the bundles available in your local repo, the installation
-of the example will be very fast, otherwise it may take some time to
-download everything needed.
+1. An endpoint bundle that includes:
+
+ - An EchoEndpoint Java class that adds an "Echo" prefix
+ to any messages it receives from the client and returns
+ the updated messages. The EchoEndpoint.java file is
+ located in the endpoint/src/main/java/org/apache/
+ servicemix/nmr/examples/nmr/endpoint directory of this
+ example.
-Testing the example
--------------------
+ - A Spring configuration file, beans.xml, which makes the
+ EchoEndpoint functionality available as a service. The
+ beans.xml file is located in the endpoint/src/main/
+ resources/META-INF/spring directory of this example.
+
+2. A client bundle that includes:
+
+ - A Client Java class that accesses the NMR and sends
+ messages to the EchoEndpoint service. The Client.java
+ file is located in the client/src/main/java/org/apache/
+ servicemix/nmr/examples/nmr/client directory of this example.
+
+ - A Spring configuration file, beans.xml, which configures
+ the client and the NMR. The beans.xml file is located
+ in the client/src/main/resources/META-INF/spring directory
+ of this example.
+
+
+Prerequisites for Building and Running the Example
+--------------------------------------------------
+1. You must have the following installed on your machine:
-When the feature is installed, you should be output from the log file every 5
-seconds
-09:35:02,450 | INFO | ndpoint-thread-1 | EchoEndpoint | amples.nmr.endpoint.EchoEndpoint 34 | Received in EchoEndpoint: Hello
-09:35:02,451 | INFO | Thread-8 | Client | x.nmr.examples.nmr.client.Client 75 | Response from Endpoint EchoHello
+ - JDK 1.5 or higher
+ - Maven 2.0.9 or higher (for building)
+
+ For more information, see the README in the top-level examples
+ directory.
+2. Start ServiceMix by running the following command:
+ <servicemix_home>/bin/servicemix (on UNIX)
+ <servicemix_home>\bin\servicemix (on Windows)
+
+
+Running the Example
+-------------------
+You can run the example in two ways:
+
+- A. Using a Prebuilt Deployment Bundle: Quick and Easy
+ This option is useful if you want to see the example up and
+ running quickly.
+
+- B. Building the Example Bundle Yourself
+ This option is useful if you want to change the example in any
+ way. It tells you how to build and deploy the example. This
+ option might be slower than option A because, if you do not
+ already have the required bundles in your local Maven
+ repository, Maven will have to download the bundles it needs.
+
+A. Using a Prebuilt Deployment Bundle: Quick and Easy
+----------------------------------------------------
+To install and run a prebuilt version of this example, enter
+the following command in the ServiceMix console:
+
+ features:install examples-nmr
+
+This command makes use of the ServiceMix features facility. For
+more information about the features facility, see the README.txt
+file in the examples parent directory.
+
+You can verify that example is running by looking at the log
+file in the data/log directory of your ServiceMix installation,
+or by typing the following command in the ServiceMix console:
+
+ log:display
+
+You should see output similar to following appearing in the
+log file every five seconds:
+
+ 09:35:02,450 | INFO | ndpoint-thread-1 | EchoEndpoint
+ | amples.nmr.endpoint.EchoEndpoint 34 | Received in EchoEndpoint: Hello
+ 09:35:02,451 | INFO | Thread-8 | Client
+ | x.nmr.examples.nmr.client.Client 75 | Response from Endpoint EchoHello
+
+
+B. Building the Example Bundle Yourself
+---------------------------------------
+To install and run the example where you build the example
+bundle yourself, complete the following steps:
+
+1. If you have already run the example using the prebuilt
+ version as described above, you must first uninstall the
+ examples-nmr feature by entering the following command
+ in the ServiceMix console:
+
+ features:uninstall examples-nmr
+
+2. Build the example by opening a command prompt, changing
+ directory to examples/nmr (this example) and entering
+ the following Maven command:
+
+ mvn install
+
+ If all of the required OSGi bundles are available in your
+ local Maven repository, the example will build quickly.
+ Otherwise it may take some time for Maven to download
+ everything it needs.
+
+ The mvn install command builds the example deployment bundles
+ and copies them to your local Maven repository and to the target
+ subdirectory of the example client and endpoint directories.
+
+3. Install the example by entering the following command in
+ the ServiceMix console:
+
+ features:install examples-nmr
+
+ This command makes use of the ServiceMix features facility. For
+ more information about the features facility, see the README.txt
+ file in the examples parent directory.
+
+You can verify that example is running by looking at the log
+file in the data/log directory of your ServiceMix installation,
+or by typing the following command in the ServiceMix console:
+
+ log:display
+
+You should see output similar to following appearing in the
+log file every five seconds:
+
+ 09:35:02,450 | INFO | ndpoint-thread-1 | EchoEndpoint
+ | amples.nmr.endpoint.EchoEndpoint 34 | Received in EchoEndpoint: Hello
+ 09:35:02,451 | INFO | Thread-8 | Client
+ | x.nmr.examples.nmr.client.Client 75 | Response from Endpoint EchoHello
+
+
+Stopping and Uninstalling the Example
+-------------------------------------
+To stop the example, you must first know the bundle ID that ServiceMix
+has assigned to it. To get the bundle ID, enter the following command
+at the ServiceMix console:
+
+ osgi:list
+
+At the end of the listing, you should see an entry similar to the
+following:
+
+[ 168] [Active ] [ ] [Started ] [ 60] Apache ServiceMix NMR Example:: NMR Endpoint (1.1.0.2)
+[ 169] [Active ] [ ] [Started ] [ 60] Apache ServiceMix NMR Example:: NMR Client (1.1.0.2)
+
+In this case, the bundle IDs are 168 and 169.
+
+To stop the example, enter the following command at the ServiceMix
+console:
+
+ osgi:stop <bundle_id>
+
+To uninstall the example, enter one of the following commands in
+the ServiceMix console:
+
+ features:uninstall examples-nmr
+
+or
+
+ osgi:uninstall <bundle_id>
\ No newline at end of file