Bootstrap FreeKB - WebMethods - Get Broker Server status in Java
WebMethods - Get Broker Server status in Java

Updated:   |  WebMethods articles

This assumes you are able to connect to WebMethods Broker Server in Java.

Here is an example class that can be used to get the Broker server status for the Broker server on server1.example.com.

import COM.activesw.api.client.*;

public class Main {
	public static void main(String[] args) {
		try {				
			BrokerServerClient server_client = new BrokerServerClient("server1.example.com", null);
			System.out.println("server_client = " + server_client);

			int status = BrokerServerClient.getServerProcessRunStatus(server);
			System.out.println("status = " + status);

		} catch (BrokerException ex) {
			System.out.println("Caught the following exception: " + ex);
		}
	}	
}

 

If the Broker server is up and running, something like this should be returned.

BrokerServerClient:
  broker_host=server1.example.com
  broker_port=6849

status = 2

 

On the other hand, if the Broker server is down or not responding, something like this could be returned.

BrokerServerClient:
  broker_host=server1.example.com
  broker_port=6849

Caught the following exception: Comm Failure (102-2050): Unable to open connection to host 'server1.example.com'.  Error 'java.net.ConnectException: Connection refused: connect' was reported by the socket call.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 74073d in the box below so that we can be sure you are a human.