ARTEMIS-877 Updates to REST module
This commit is contained in:
parent
8057ec4b27
commit
3abfd9f552
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
import org.apache.activemq.artemis.core.server.RoutingType;
|
||||
import org.apache.activemq.artemis.jms.client.ConnectionFactoryOptions;
|
||||
import org.apache.activemq.artemis.rest.queue.push.FilePushStore;
|
||||
import org.apache.activemq.artemis.rest.queue.push.PushStore;
|
||||
|
@ -82,9 +83,15 @@ public class QueueServiceManager extends DestinationServiceManager {
|
|||
}
|
||||
String queueName = queueDeployment.getName();
|
||||
try (ClientSession session = sessionFactory.createSession(false, false, false)) {
|
||||
ClientSession.QueueQuery query = session.queueQuery(new SimpleString(queueName));
|
||||
ClientSession.AddressQuery query = session.addressQuery(SimpleString.toSimpleString(queueName));
|
||||
if (!query.isExists()) {
|
||||
session.createQueue(queueName, queueName, queueDeployment.isDurableSend());
|
||||
session.createAddress(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, true);
|
||||
session.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), queueDeployment.isDurableSend());
|
||||
} else {
|
||||
ClientSession.QueueQuery qquery = session.queueQuery(SimpleString.toSimpleString(queueName));
|
||||
if (!qquery.isExists()) {
|
||||
session.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), queueDeployment.isDurableSend());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
import org.apache.activemq.artemis.core.server.RoutingType;
|
||||
import org.apache.activemq.artemis.jms.client.ConnectionFactoryOptions;
|
||||
import org.apache.activemq.artemis.rest.queue.DestinationServiceManager;
|
||||
|
||||
|
@ -83,14 +84,12 @@ public class TopicServiceManager extends DestinationServiceManager {
|
|||
}
|
||||
String queueName = topicDeployment.getName();
|
||||
boolean defaultDurable;
|
||||
|
||||
try (ClientSession session = sessionFactory.createSession(false, false, false)) {
|
||||
ClientSession.QueueQuery query = session.queueQuery(new SimpleString(queueName));
|
||||
defaultDurable = topicDeployment.isDurableSend();
|
||||
if (query.isExists()) {
|
||||
defaultDurable = query.isDurable();
|
||||
} else {
|
||||
session.createQueue(queueName, queueName, topicDeployment.isDurableSend());
|
||||
}
|
||||
ClientSession.AddressQuery query = session.addressQuery(new SimpleString(queueName));
|
||||
if (!query.isExists())
|
||||
session.createAddress(SimpleString.toSimpleString(queueName), RoutingType.MULTICAST, true);
|
||||
}
|
||||
|
||||
destination.createTopicResource(queueName, defaultDurable, topicDeployment.getConsumerSessionTimeoutSeconds(), topicDeployment.isDuplicatesAllowed());
|
||||
|
|
|
@ -46,7 +46,7 @@ public class SelectorTest extends MessageTestBase {
|
|||
|
||||
public static ConnectionFactory connectionFactory;
|
||||
public static String topicName = "testTopic";
|
||||
public static String prefixedTopicName = ActiveMQDestination.createQueueAddressFromName(topicName).toString();
|
||||
public static String prefixedTopicName = ActiveMQDestination.createTopicAddressFromName(topicName).toString();
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue