Search in sources :

Example 11 with Notification

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;
}
Also used : SimpleString(org.apache.activemq.artemis.api.core.SimpleString) TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) Notification(org.apache.activemq.artemis.core.server.management.Notification)

Example 12 with Notification

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;
}
Also used : ClusterConnection(org.apache.activemq.artemis.core.server.cluster.ClusterConnection) Connection(org.apache.activemq.artemis.spi.core.remoting.Connection) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) Notification(org.apache.activemq.artemis.core.server.management.Notification) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException)

Example 13 with Notification

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());
    }
}
Also used : TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) Notification(org.apache.activemq.artemis.core.server.management.Notification) NamingException(javax.naming.NamingException) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) ActiveMQAddressDoesNotExistException(org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException) UnknownHostException(java.net.UnknownHostException)

Example 14 with Notification

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);
    }
}
Also used : TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) Notification(org.apache.activemq.artemis.core.server.management.Notification)

Example 15 with Notification

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);
}
Also used : TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) Notification(org.apache.activemq.artemis.core.server.management.Notification)

Aggregations

Notification (org.apache.activemq.artemis.core.server.management.Notification)35 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)26 TypedProperties (org.apache.activemq.artemis.utils.collections.TypedProperties)24 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)9 Test (org.junit.Test)9 SimpleNotificationService (org.apache.activemq.artemis.tests.integration.SimpleNotificationService)5 CountDownLatch (java.util.concurrent.CountDownLatch)3 ActiveMQInterruptedException (org.apache.activemq.artemis.api.core.ActiveMQInterruptedException)3 Channel (io.netty.channel.Channel)2 ServerChannel (io.netty.channel.ServerChannel)2 EpollServerSocketChannel (io.netty.channel.epoll.EpollServerSocketChannel)2 KQueueServerSocketChannel (io.netty.channel.kqueue.KQueueServerSocketChannel)2 LocalServerChannel (io.netty.channel.local.LocalServerChannel)2 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)2 InetAddress (java.net.InetAddress)2 ActiveMQIllegalStateException (org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException)2 ActiveMQNonExistentQueueException (org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException)2 BroadcastEndpoint (org.apache.activemq.artemis.api.core.BroadcastEndpoint)2 CoreNotificationType (org.apache.activemq.artemis.api.core.management.CoreNotificationType)2 ClusterConnection (org.apache.activemq.artemis.core.server.cluster.ClusterConnection)2