Search in sources :

Example 1 with ActiveMQServer

use of org.apache.activemq.artemis.core.server.ActiveMQServer in project wildfly by wildfly.

the class JMSServerControlHandler method getServerControl.

private JMSServerControl getServerControl(final OperationContext context, final ModelNode operation) {
    final ServiceName serviceName = MessagingServices.getActiveMQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
    ServiceController<?> service = context.getServiceRegistry(false).getService(serviceName);
    ActiveMQServer server = ActiveMQServer.class.cast(service.getValue());
    return JMSServerControl.class.cast(server.getManagementService().getResource(ResourceNames.JMS_SERVER));
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) ServiceName(org.jboss.msc.service.ServiceName)

Example 2 with ActiveMQServer

use of org.apache.activemq.artemis.core.server.ActiveMQServer in project wildfly by wildfly.

the class JMSTopicRemove method performRuntime.

protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    final ServiceName serviceName = MessagingServices.getActiveMQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
    final String name = context.getCurrentAddress().getLastElement().getValue();
    ServiceController<?> service = context.getServiceRegistry(false).getService(serviceName);
    ActiveMQServer server = ActiveMQServer.class.cast(service.getValue());
    JMSServerControl control = JMSServerControl.class.cast(server.getManagementService().getResource(ResourceNames.JMS_SERVER));
    if (control != null) {
        try {
            control.destroyTopic(name, true);
        } catch (Exception e) {
            throw new OperationFailedException(e);
        }
    }
    context.removeService(JMSServices.getJmsTopicBaseServiceName(serviceName).append(name));
    for (String entry : CommonAttributes.DESTINATION_ENTRIES.unwrap(context, model)) {
        final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(entry);
        ServiceName binderServiceName = bindInfo.getBinderServiceName();
        context.removeService(binderServiceName);
    }
    for (String legacyEntry : CommonAttributes.LEGACY_ENTRIES.unwrap(context, model)) {
        final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(legacyEntry);
        ServiceName binderServiceName = bindInfo.getBinderServiceName();
        context.removeService(binderServiceName);
    }
}
Also used : JMSServerControl(org.apache.activemq.artemis.api.jms.management.JMSServerControl) ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) ServiceName(org.jboss.msc.service.ServiceName) OperationFailedException(org.jboss.as.controller.OperationFailedException) OperationFailedException(org.jboss.as.controller.OperationFailedException) ContextNames(org.jboss.as.naming.deployment.ContextNames)

Example 3 with ActiveMQServer

use of org.apache.activemq.artemis.core.server.ActiveMQServer in project wildfly by wildfly.

the class QueueService method start.

/** {@inheritDoc} */
@Override
public synchronized void start(StartContext context) throws StartException {
    try {
        final ActiveMQServer server = this.activeMQServer.getValue();
        server.deployQueue(new SimpleString(queueConfiguration.getAddress()), new SimpleString(queueConfiguration.getName()), SimpleString.toSimpleString(queueConfiguration.getFilterString()), queueConfiguration.isDurable(), temporary);
    } catch (Exception e) {
        throw new StartException(e);
    }
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) StartException(org.jboss.msc.service.StartException) StartException(org.jboss.msc.service.StartException)

Example 4 with ActiveMQServer

use of org.apache.activemq.artemis.core.server.ActiveMQServer in project wildfly by wildfly.

the class QueueService method stop.

/** {@inheritDoc} */
@Override
public synchronized void stop(StopContext context) {
    try {
        final ActiveMQServer server = this.activeMQServer.getValue();
        server.destroyQueue(new SimpleString(queueConfiguration.getName()), null, false);
    } catch (Exception e) {
        MessagingLogger.ROOT_LOGGER.failedToDestroy("queue", queueConfiguration.getName());
    }
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) StartException(org.jboss.msc.service.StartException)

Example 5 with ActiveMQServer

use of org.apache.activemq.artemis.core.server.ActiveMQServer in project wildfly by wildfly.

the class JMSQueueReadAttributeHandler method getControl.

private JMSQueueControl getControl(OperationContext context, ModelNode operation) {
    String queueName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
    final ServiceName serviceName = MessagingServices.getActiveMQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
    ServiceController<?> service = context.getServiceRegistry(false).getService(serviceName);
    ActiveMQServer server = ActiveMQServer.class.cast(service.getValue());
    JMSQueueControl control = JMSQueueControl.class.cast(server.getManagementService().getResource(ResourceNames.JMS_QUEUE + queueName));
    return control;
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) JMSQueueControl(org.apache.activemq.artemis.api.jms.management.JMSQueueControl) ServiceName(org.jboss.msc.service.ServiceName)

Aggregations

ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)37 ServiceName (org.jboss.msc.service.ServiceName)20 PathAddress (org.jboss.as.controller.PathAddress)19 OperationFailedException (org.jboss.as.controller.OperationFailedException)12 ModelNode (org.jboss.dmr.ModelNode)9 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)5 ActiveMQActivationService.getActiveMQServer (org.wildfly.extension.messaging.activemq.ActiveMQActivationService.getActiveMQServer)4 Role (org.apache.activemq.artemis.core.security.Role)3 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)3 HttpServerExchange (io.undertow.server.HttpServerExchange)2 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)2 ConnectionFactoryControl (org.apache.activemq.artemis.api.jms.management.ConnectionFactoryControl)2 JMSServerControl (org.apache.activemq.artemis.api.jms.management.JMSServerControl)2 TopicControl (org.apache.activemq.artemis.api.jms.management.TopicControl)2 RemotingService (org.apache.activemq.artemis.core.remoting.server.RemotingService)2 OperationContext (org.jboss.as.controller.OperationContext)2 Resource (org.jboss.as.controller.registry.Resource)2 ContextNames (org.jboss.as.naming.deployment.ContextNames)2 StartException (org.jboss.msc.service.StartException)2 SocketChannel (io.netty.channel.socket.SocketChannel)1