@ManagedAttribute(description = "Component State")
public String getState() {
// must use String type to be sure remote JMX can read the attribute without requiring Camel classes.
if (component instanceof ServiceSupport) {
ServiceStatus status = ((ServiceSupport) component).getStatus();
// if no status exists then its stopped
if (status == null) {
status = ServiceStatus.Stopped;
}
return status.name();
}
// assume started if not a ServiceSupport instance
return ServiceStatus.Started.name();
}