Skip to content

Unable to send messages direct to queues which have a DEAD-LETTER associated. #36

@markslilley

Description

@markslilley

I'm trying to fork this and add X-DEAD-LETTER-EXCHANGE and X-DEAD-LETTER-ROUTING-KEY. This will enable direct to queue messages where there is a dead letter attached. I have added fields to AMQPSampler.java and AMQPSamplerGui.java is there anything else I need to update?

When I publish messages with this amended code I see messages land on the Rabbit Overview page but the message does not arrive in the queue (with an attached DEAD LETTER linked)

I've added to AMQPSampler.java

    private static final String X_DEAD_LETTER_EXCHANGE     = "AMQPSampler.XDeadLetterExchange";
    private static final String X_DEAD_LETTER_ROUTING_KEY  = "AMQPSampler.XDeadLetterRoutingKey";
    
    public static final String DEFAULT_X_DEAD_LETTER_EXCHANGE = "jmeterDeadLetterExchange";
    public static final String DEFAULT_X_DEAD_LETTER_ROUTING_KEY = "jmeterDeadLetterRoutingKey";
    
    if (getXDeadLetterExchange() != null && !getXDeadLetterExchange().isEmpty()) {
        arguments.put("x-dead-letter-exchange", getXDeadLetterExchange());
    }

    if (getXDeadLetterRoutingKey() != null && !getXDeadLetterRoutingKey().isEmpty()) {
        arguments.put("x-dead-letter-routing-key", getXDeadLetterRoutingKey());
    }
    
    public String getXDeadLetterRoutingKey() {
        return getPropertyAsString(X_DEAD_LETTER_ROUTING_KEY);
    }

    public void setXDeadLetterExchange(String name) {
        setProperty(X_DEAD_LETTER_EXCHANGE, name);
    }

    public void setXDeadLetterRoutingKey(String name) {
        setProperty(X_DEAD_LETTER_ROUTING_KEY, name);
    }

Added the following to AMQPSamplerGui.java

    protected JLabeledTextField xDeadLetterExchange = new JLabeledTextField("x-dead-letter-exchange");
    protected JLabeledTextField xDeadLetterRoutingKey = new JLabeledTextField("x-dead-letter-routing-key");

    xDeadLetterExchange.setText(sampler.getXDeadLetterExchange());
    xDeadLetterRoutingKey.setText(sampler.getXDeadLetterRoutingKey());

    xDeadLetterExchange.setText(AMQPSampler.DEFAULT_X_DEAD_LETTER_EXCHANGE);
    xDeadLetterRoutingKey.setText(AMQPSampler.DEFAULT_X_DEAD_LETTER_ROUTING_KEY);

    sampler.setXDeadLetterExchange(xDeadLetterExchange.getText());
    sampler.setXDeadLetterRoutingKey(xDeadLetterRoutingKey.getText());

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    queueSettings.add(xDeadLetterExchange, gridBagConstraints);

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    queueSettings.add(xDeadLetterRoutingKey, gridBagConstraints);
    

Amended GUI showing new fields.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions