use of org.apache.activemq.artemis.core.server.management.Notification in project activemq-artemis by apache.
the class InVMAcceptor method start.
@Override
public synchronized void start() throws Exception {
if (started) {
return;
}
InVMRegistry.instance.registerAcceptor(id, this);
if (notificationService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("factory"), new SimpleString(InVMAcceptorFactory.class.getName()));
props.putIntProperty(new SimpleString("id"), id);
Notification notification = new Notification(null, CoreNotificationType.ACCEPTOR_STARTED, props);
notificationService.sendNotification(notification);
}
started = true;
paused = false;
}
use of org.apache.activemq.artemis.core.server.management.Notification in project activemq-artemis by apache.
the class InVMAcceptor method stop.
@Override
public synchronized void stop() {
if (!started) {
return;
}
if (!paused) {
InVMRegistry.instance.unregisterAcceptor(id);
}
for (Connection connection : connections.values()) {
listener.connectionDestroyed(connection.getID());
}
connections.clear();
if (notificationService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("factory"), new SimpleString(InVMAcceptorFactory.class.getName()));
props.putIntProperty(new SimpleString("id"), id);
Notification notification = new Notification(null, CoreNotificationType.ACCEPTOR_STOPPED, props);
try {
notificationService.sendNotification(notification);
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.failedToSendNotification(e);
}
}
started = false;
paused = false;
}
use of org.apache.activemq.artemis.core.server.management.Notification in project activemq-artemis by apache.
the class JMSServerManagerImpl method sendNotification.
private void sendNotification(JMSNotificationType type, String message) {
TypedProperties prop = new TypedProperties();
prop.putSimpleStringProperty(JMSNotificationType.MESSAGE, SimpleString.toSimpleString(message));
Notification notif = new Notification(null, type, prop);
try {
server.getManagementService().sendNotification(notif);
} catch (Exception e) {
ActiveMQJMSServerLogger.LOGGER.failedToSendNotification(notif.toString());
}
}
use of org.apache.activemq.artemis.core.server.management.Notification in project activemq-artemis by apache.
the class GroupHandlingAbstract method sendUnproposal.
protected void sendUnproposal(SimpleString groupid, SimpleString clusterName, int distance) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, groupid);
props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, clusterName);
props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance);
Notification notification = new Notification(null, CoreNotificationType.UNPROPOSAL, props);
try {
managementService.sendNotification(notification);
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.errorHandlingMessage(e);
}
}
use of org.apache.activemq.artemis.core.server.management.Notification in project activemq-artemis by apache.
the class RemoteGroupingHandler method createProposalNotification.
private Notification createProposalNotification(SimpleString groupId, SimpleString clusterName) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, groupId);
props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, clusterName);
props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
props.putIntProperty(ManagementHelper.HDR_DISTANCE, 0);
return new Notification(null, CoreNotificationType.PROPOSAL, props);
}
Aggregations