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));
}
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);
}
}
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);
}
}
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());
}
}
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;
}
Aggregations