Search in sources :

Example 16 with TypedProperties

use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.

the class BridgeImpl method pause.

@Override
public void pause() throws Exception {
    if (logger.isDebugEnabled()) {
        logger.debug("Bridge " + this.name + " being paused");
    }
    executor.execute(new PauseRunnable());
    if (notificationService != null) {
        TypedProperties props = new TypedProperties();
        props.putSimpleStringProperty(new SimpleString("name"), name);
        Notification notification = new Notification(nodeUUID.toString(), CoreNotificationType.BRIDGE_STOPPED, props);
        try {
            notificationService.sendNotification(notification);
        } catch (Exception e) {
            ActiveMQServerLogger.LOGGER.notificationBridgeStoppedError(e);
        }
    }
}
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) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) ActiveMQInterruptedException(org.apache.activemq.artemis.api.core.ActiveMQInterruptedException)

Example 17 with TypedProperties

use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.

the class BridgeImpl method start.

@Override
public synchronized void start() throws Exception {
    if (started) {
        return;
    }
    started = true;
    stopping = false;
    activate();
    if (notificationService != null) {
        TypedProperties props = new TypedProperties();
        props.putSimpleStringProperty(new SimpleString("name"), name);
        Notification notification = new Notification(nodeUUID.toString(), CoreNotificationType.BRIDGE_STARTED, props);
        notificationService.sendNotification(notification);
    }
}
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 18 with TypedProperties

use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.

the class BroadcastGroupImpl method stop.

@Override
public synchronized void stop() {
    if (!started) {
        return;
    }
    if (future != null) {
        future.cancel(false);
    }
    try {
        endpoint.close(true);
    } catch (Exception e1) {
        ActiveMQServerLogger.LOGGER.broadcastGroupClosed(e1);
    }
    started = false;
    if (notificationService != null) {
        TypedProperties props = new TypedProperties();
        props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name));
        Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.BROADCAST_GROUP_STOPPED, props);
        try {
            notificationService.sendNotification(notification);
        } catch (Exception e) {
            ActiveMQServerLogger.LOGGER.broadcastGroupClosed(e);
        }
    }
}
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 19 with TypedProperties

use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.

the class ClusterConnectionImpl method activate.

private synchronized void activate() throws Exception {
    if (!started) {
        return;
    }
    if (logger.isDebugEnabled()) {
        logger.debug("Activating cluster connection nodeID=" + nodeManager.getNodeId() + " for server=" + this.server);
    }
    liveNotifier = new LiveNotifier();
    liveNotifier.updateAsLive();
    liveNotifier.schedule();
    serverLocator = clusterConnector.createServerLocator();
    if (serverLocator != null) {
        if (!useDuplicateDetection) {
            logger.debug("DuplicateDetection is disabled, sending clustered messages blocked");
        }
        final TopologyMember currentMember = topology.getMember(manager.getNodeId());
        if (currentMember == null) {
            // sanity check only
            throw new IllegalStateException("InternalError! The ClusterConnection doesn't know about its own node = " + this);
        }
        serverLocator.setNodeID(nodeManager.getNodeId().toString());
        serverLocator.setIdentity("(main-ClusterConnection::" + server.toString() + ")");
        serverLocator.setReconnectAttempts(0);
        serverLocator.setClusterConnection(true);
        serverLocator.setClusterTransportConfiguration(connector);
        serverLocator.setInitialConnectAttempts(-1);
        serverLocator.setClientFailureCheckPeriod(clientFailureCheckPeriod);
        serverLocator.setConnectionTTL(connectionTTL);
        serverLocator.setConfirmationWindowSize(confirmationWindowSize);
        // if not using duplicate detection, we will send blocked
        serverLocator.setBlockOnDurableSend(!useDuplicateDetection);
        serverLocator.setBlockOnNonDurableSend(!useDuplicateDetection);
        serverLocator.setCallTimeout(callTimeout);
        serverLocator.setCallFailoverTimeout(callFailoverTimeout);
        serverLocator.setProducerWindowSize(producerWindowSize);
        if (retryInterval > 0) {
            this.serverLocator.setRetryInterval(retryInterval);
        }
        serverLocator.setAfterConnectionInternalListener(this);
        serverLocator.setProtocolManagerFactory(ActiveMQServerSideProtocolManagerFactory.getInstance(serverLocator));
        serverLocator.start(server.getExecutorFactory().getExecutor());
    }
    if (managementService != null) {
        TypedProperties props = new TypedProperties();
        props.putSimpleStringProperty(new SimpleString("name"), name);
        Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.CLUSTER_CONNECTION_STARTED, props);
        logger.debug("sending notification: " + notification);
        managementService.sendNotification(notification);
    }
    // we add as a listener after we have sent the cluster start notif as the listener may start sending notifs before
    addClusterTopologyListener(this);
}
Also used : SimpleString(org.apache.activemq.artemis.api.core.SimpleString) TopologyMember(org.apache.activemq.artemis.api.core.client.TopologyMember) TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) Notification(org.apache.activemq.artemis.core.server.management.Notification)

Example 20 with TypedProperties

use of org.apache.activemq.artemis.utils.collections.TypedProperties 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)

Aggregations

TypedProperties (org.apache.activemq.artemis.utils.collections.TypedProperties)43 Notification (org.apache.activemq.artemis.core.server.management.Notification)24 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)23 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)8 Test (org.junit.Test)5 ActiveMQInterruptedException (org.apache.activemq.artemis.api.core.ActiveMQInterruptedException)3 ByteBuf (io.netty.buffer.ByteBuf)2 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 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)2 ActiveMQIllegalStateException (org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException)2 ActiveMQNonExistentQueueException (org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException)2 ClusterConnection (org.apache.activemq.artemis.core.server.cluster.ClusterConnection)2 Connection (org.apache.activemq.artemis.spi.core.remoting.Connection)2 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)1 ChannelInitializer (io.netty.channel.ChannelInitializer)1