Search in sources :

Example 21 with TypedProperties

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

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

the class OpenWireMessageConverter method writeMapType.

private static void writeMapType(final ByteSequence contents, final boolean messageCompressed, final ActiveMQBuffer body) throws IOException {
    InputStream mis = new ByteArrayInputStream(contents);
    if (messageCompressed) {
        mis = new InflaterInputStream(mis);
    }
    DataInputStream mdataIn = new DataInputStream(mis);
    Map<String, Object> map = MarshallingSupport.unmarshalPrimitiveMap(mdataIn);
    mdataIn.close();
    TypedProperties props = new TypedProperties();
    loadMapIntoProperties(props, map);
    props.encode(body.byteBuf());
}
Also used : ByteArrayInputStream(org.apache.activemq.util.ByteArrayInputStream) DataInputStream(java.io.DataInputStream) InflaterInputStream(java.util.zip.InflaterInputStream) ByteArrayInputStream(org.apache.activemq.util.ByteArrayInputStream) InputStream(java.io.InputStream) InflaterInputStream(java.util.zip.InflaterInputStream) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) DataInputStream(java.io.DataInputStream) TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties)

Example 23 with TypedProperties

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

the class AMQPMessagePersisterV2 method getEncodeSize.

@Override
public int getEncodeSize(Message record) {
    int encodeSize = super.getEncodeSize(record) + DataConstants.SIZE_INT;
    TypedProperties properties = ((AMQPMessage) record).getExtraProperties();
    return encodeSize + (properties != null ? properties.getEncodeSize() : 0);
}
Also used : TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties)

Example 24 with TypedProperties

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

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

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