Sample 601: Using Synapse Observers

Objective

Demonstrate the ability to monitor the Synapse configuration at runtime using the SynapseObserver interface

Running the Sample

Open the synapse.properties file in the SYNAPSE_HOME/repository/conf directory using a text editor and uncomment the line which defines the simple logging Synapse observer.

synapse.observers=samples.userguide.SimpleLoggingObserver

Open the log4j.properties file in the SYNAPSE_HOME/lib directory and uncomment the line which sets the INFO log level to the samples.userguide package.

log4j.category.samples.userguide=INFO

Start Synapse using any of the sample configurations. The SimpleLoggingObserver will capture events that occur while constructing the Synapse configuration and log them on the console as follows.

2009年08月06日 14:30:24,578 [-] [main] INFO SimpleLoggingObserver Simple logging observer initialized...Capturing Synapse events... 2009年08月06日 14:30:24,604 [-] [main] INFO SimpleLoggingObserver Endpoint : a3 was added to the Synapse configuration successfully 2009年08月06日 14:30:24,605 [-] [main] INFO SimpleLoggingObserver Endpoint : a2 was added to the Synapse configuration successfully 2009年08月06日 14:30:24,606 [-] [main] INFO SimpleLoggingObserver Endpoint : null was added to the Synapse configuration successfully 2009年08月06日 14:30:24,611 [-] [main] INFO SimpleLoggingObserver Local entry : a1 was added to the Synapse configuration successfully 2009年08月06日 14:30:24,649 [-] [main] INFO SimpleLoggingObserver Proxy service : StockQuoteProxy2 was added to the Synapse configuration successfully 2009年08月06日 14:30:24,661 [-] [main] INFO SimpleLoggingObserver Proxy service : StockQuoteProxy1 was added to the Synapse configuration successfully 2009年08月06日 14:30:24,664 [-] [main] INFO SimpleLoggingObserver Sequence : main was added to the Synapse configuration successfully 2009年08月06日 14:30:24,701 [-] [main] INFO SimpleLoggingObserver Sequence : fault was added to the Synapse configuration successfully

The SimpleLoggingObserver is implemented as follows. It does not override any of the event handler implementations in the AbstractSynapseObserver class. The AbstractSynapseObserver logs all the received events by default.

package samples.userguide; import org.apache.synapse.config.AbstractSynapseObserver; public class SimpleLoggingObserver extends AbstractSynapseObserver { public SimpleLoggingObserver() { super(); log.info("Simple logging observer initialized...Capturing Synapse events..."); } }

Back to Catalog


AltStyle によって変換されたページ (->オリジナル) /