@@ -0,0 +1,1319 @@
+package org.iotbricks.core.binding.proton;%0A%0Aimport java.util.Collections;%0Aimport java.util.Map;%0Aimport java.util.Optional;%0Aimport java.util.function.Consumer;%0Aimport java.util.function.Function;%0A%0Aimport org.apache.qpid.proton.amqp.messaging.ApplicationProperties;%0Aimport org.apache.qpid.proton.message.Message;%0Aimport org.iotbricks.core.binding.amqp.AmqpRequestContext;%0Aimport org.iotbricks.core.binding.common.MessageResponseHandler;%0A%0A/**%0A * A specialized %7B@link MessageResponseHandler%7D for errors.%0A * %3Cp%3E%0A * This handler also sets the application property %7B@code status%7D to %7B@code 500%7D%0A * on the proton message. Indicating an error to the receiver.%0A */%0Apublic class ProtonErrorMessageResponseHandler extends MessageResponseHandler%3CProtonRequestContext, Message%3E %7B%0A%0A    private static final Consumer%3CMessage%3E SET_TO_500 = message -%3E %7B%0A        final Map%3CString, ?%3E properties = Collections.singletonMap(%22status%22, 500);%0A        message.setApplicationProperties(new ApplicationProperties(properties));%0A    %7D;%0A%0A    public ProtonErrorMessageResponseHandler(%0A            final Function%3CProtonRequestContext, Optional%3CString%3E%3E responseAddressProvider) %7B%0A        super(responseAddressProvider, SET_TO_500);%0A    %7D%0A%0A    public ProtonErrorMessageResponseHandler() %7B%0A        super(AmqpRequestContext::getReplyToAddress);%0A    %7D%0A%0A%7D%0A

Add a proton specific error response handler