I have a .NETcore application/client which has several defined endpoints to get data from the broker. One end point is to get a list of all of the addresses but when I run it it gives back an empty response. We are using amq7. Would the C# code need to be refactored to leverage Artemis? How would I be able to get Broker/Queue metrics in Artemis with .NET? Below is an example of the code the code we are using from the ActiveMQ NMS website
using System;
using Apache.NMS;
using Apache.NMS.Util;
using Apache.NMS.ActiveMQ;
using Apache.NMS.ActiveMQ.Commands;
namespace AdvisoryExample
{
class AdvisoryExample
{
private IConnection connection;
private ISession session;
public const String QUEUE\_ADVISORY\_DESTINATION = "ActiveMQ.Advisory.Queue";
public const String TOPIC\_ADVISORY\_DESTINATION = "ActiveMQ.Advisory.Topic";
public const String TEMPQUEUE\_ADVISORY\_DESTINATION = "ActiveMQ.Advisory.TempQueue";
public const String TEMPTOPIC\_ADVISORY\_DESTINATION = "ActiveMQ.Advisory.TempTopic";
public const String ALLDEST\_ADVISORY\_DESTINATION = QUEUE\_ADVISORY\_DESTINATION + "," +
TOPIC\_ADVISORY\_DESTINATION + "," +
TEMPQUEUE\_ADVISORY\_DESTINATION + "," +
TEMPTOPIC\_ADVISORY\_DESTINATION;
AdvisoryExample()
{
IConnectionFactory factory = new ConnectionFactory();
connection = factory.CreateConnection();
connection.Start();
session = connection.CreateSession();
}
void EnumerateQueues()
{
Console.WriteLine("Listing all Queues on Broker:");
IDestination dest = session.GetTopic(QUEUE\_ADVISORY\_DESTINATION);
using(IMessageConsumer consumer = session.CreateConsumer(dest))
{
IMessage advisory;
while((advisory = consumer.Receive(TimeSpan.FromMilliseconds(2000))) != null)
{
ActiveMQMessage amqMsg = advisory as ActiveMQMessage;
if(amqMsg.DataStructure != null)
{
DestinationInfo info = amqMsg.DataStructure as DestinationInfo;
if(info != null)
{
Console.WriteLine(" Queue: " + info.Destination.ToString() );
}
}
}
}
Console.WriteLine("Listing Complete.");
}