synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Fremantle" <>
Subject Re: Mediator init and destroy
Date Thu, 26 Jul 2007 14:24:12 GMT
Here is a simple example of what I'd like to be able to do

As you can see it would make it dead simple to add a new adapter. In
this case, all you need to do to get XML from gmond is to open a
socket to it.

The changes we'd need to make this work are:

1) create a synapse interface Initializable which could be implemented
both by mediators and also by stuff like adapters that need to be run
but aren't mediators
2) Add a way of specifying things that need to be started in the Synapse config:

   <init class="org.fremantle.GMondPuller"/>

2) need to be able to get at the thread pool from the
SynapseEnvironment (this could just be a link into the Axis2 thread
3) Fix createMessageContext!
4) I think that is it.

public class GMondPuller implements Initializable, Runnable {

	private String hostName = null;
	private int port = 0;
	private long interval = 1000;
	private SynapseEnvironment synapseEnvironment = null;
	public void init(SynapseConfiguration sc, SynapseEnvironment se) {	
		synapseEnvironment = se;

	public void run() {
		if (hostName == null || port == 0 || synapseEnvironment == null)
		try {
			while (true) { socket = new Socket(hostName, port);
				StAXOMBuilder builder = new StAXOMBuilder(socket
				MessageContext mc =
		} catch (Exception e) {


	public void setHostName(String hostName) {
		this.hostName = hostName;

	public String getHostName() {
		return hostName;

	public void setPort(int port) {
		this.port = port;

	public int getPort() {
		return port;

	public void setInterval(long interval) {
		this.interval = interval;

	public long getInterval() {
		return interval;

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message