1

I want to use this enum structure in order to return string.

public enum Exchanges {

    PROCESSING("processing");

    private final String type;

    Exchanges(final String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    @Override
    public String toString() {
        return type;
    }
}

When I use Exchanges.PROCESSING I get error:

Syntax error, insert "VariableDeclarators" to complete 
 LocalVariableDeclaration

How I can fix this issue?

Peter Penzov
  • 1,126
  • 134
  • 430
  • 808

1 Answers1

3
channel.exchangeDeclare(String exchange , BuiltinExchangeType obj)

should be

channel.exchangeDeclare(Exchanges exchange , BuiltinExchangeType obj)

or you should change the method call

channel.exchangeDeclare(Exchanges.PROCESSING, BuiltinExchangeType.TOPIC);

to

channel.exchangeDeclare(Exchanges.PROCESSING.getType(), BuiltinExchangeType.TOPIC);
Lorelorelore
  • 3,335
  • 8
  • 29
  • 40