Hi,

I'm trying to use QPID in-memory for the purpose of an integration test against 
a RabbitMQ consumer.

My application uses a RabbitMQ specific queue declaration argument (x-expires). 
I've seen through googling that "queue.behaviourOnUnknownDeclareArgument: 
Ignore" Will do what I want to do.

This is what my config looks like at the moment (I'm making guesses about the 
nodeAutoCreationPolicies being the default template for how elements are 
created...):
=======================
{
  "name": "Embedded Broker",
  "modelVersion": "7.0",
  "authenticationproviders": [
    {
      "name": "hardcoded",
      "type": "Plain",
      "secureOnlyMechanisms": [],
      "users": [
        {
          "name": "guest",
          "password": "guest",
          "type": "managed"
        }
      ]
    }
  ],
  "ports": [
    {
      "name": "AMQP",
      "port": "${qpid.amqp_port}",
      "bindingAddress": "127.0.0.1",
      "protocols": [
        "AMQP_0_9_1"
      ],
      "authenticationProvider": "hardcoded",
      "virtualhostaliases": [
        {
          "name": "defaultAlias",
          "type": "defaultAlias"
        }
      ]
    }
  ],
  "virtualhostnodes": [
    {
      "name": "default",
      "type": "Memory",
      "defaultVirtualHostNode": "true",
      "virtualHostInitialConfiguration": "{\"type\": \"Memory\", 
\"nodeAutoCreationPolicies\": 
[{\"pattern\":\".*\",\"createdOnPublish\":\"true\",\"createdOnConsume\":\"true\",\"nodeType\":\"queue\",
 \"attributes\": {\"queue.behaviourOnUnknownDeclareArgument\":\"IGNORE\"}}]}"
    }
  ]
}
=========================

And it's doesn't appear to be doing anything as my application is throwing:
===============
java.io.IOException: null
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:129)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:125)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:147)
at com.rabbitmq.client.impl.ChannelN.queueDeclare(ChannelN.java:968)
at 
com.rabbitmq.client.impl.recovery.AutorecoveringChannel.queueDeclare(AutorecoveringChannel.java:342)
...
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; 
protocol method: #method<connection.close>(reply-code=542, reply-text=Error 
creating queue 'myqueue_dtmanager_task': Unsupported queue declare argument(s) 
: x-expires, class-id=50, method-id=10) at 
com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
===============


This is how I am initialising my broker:
===================

public class BrokerManager {

    private static final String DEFAULT_INITIAL_CONFIGURATION_LOCATION = 
"qpid-it.json";

    private SystemLauncher systemLauncher;

    public BrokerManager() {
        this.systemLauncher = new SystemLauncher();
    }

    public void start() throws Exception {
        this.systemLauncher.startup(createSystemConfig());
    }

    public void shutdown() {
        this.systemLauncher.shutdown();
    }

    private Map<String, Object> createSystemConfig() throws 
IllegalConfigurationException {
        Map<String, Object> attributes = new HashMap<>();
        URL initialConfigUrl = 
BrokerManager.class.getClassLoader().getResource(DEFAULT_INITIAL_CONFIGURATION_LOCATION);
        if (initialConfigUrl == null) {
        throw new IllegalConfigurationException("Configuration location '" + 
DEFAULT_INITIAL_CONFIGURATION_LOCATION + "' not found");
    }
        attributes.put(SystemConfig.TYPE, "Memory");
        attributes.put(SystemConfig.INITIAL_CONFIGURATION_LOCATION, 
initialConfigUrl.toExternalForm());
        attributes.put(SystemConfig.STARTUP_LOGGED_TO_SYSTEM_OUT, true);
        return attributes;
    }
}

==================

Any help you can offer or documentation you can point me to as to where/how to 
set the configuration properties on a queue for an in-memory QPID broker would 
be great as I've been failing spectacularly.

For completeness. I've mostly been following this page 
https://novotnyr.github.io/scrolls/qpid-as-mocking-amqp-broker-for-integration-tests/
 and using trial + error

And I am encouraged that this is possible because of the discussion here: 
https://issues.apache.org/jira/browse/QPID-8388

Thanks in advance,
Simon.

Reply via email to