sender.setCondition(new ErrorCondition(AmqpError.INVALID_FIELD, "No source terminus specified")); sender.open(); sender.close();
receiver.setCondition(new ErrorCondition(AmqpError.INVALID_FIELD, "No target terminus specified")); receiver.open(); receiver.close();
public End(End other) { if (other._error != null) { this._error = new ErrorCondition(); this._error.copyFrom(other._error); } }
public Detach(Detach other) { this._handle = other._handle; this._closed = other._closed; if (other._error != null) { this._error = new ErrorCondition(); this._error.copyFrom(other._error); } }
/** * Create a new AMQP error condition * * @param error AMQP error * @param description description for the AMQP error condition * @return AMQP error condition */ static ErrorCondition newError(String error, String description) { return new ErrorCondition(Symbol.getSymbol(error), description); }
public Close(Close other) { if (other._error != null) { this._error = new ErrorCondition(); this._error.copyFrom(other._error); } }
private void commitHandler(AsyncResult<Void> seekResult) { if (seekResult.failed()) { ErrorCondition condition = new ErrorCondition(Symbol.getSymbol(AmqpBridge.AMQP_ERROR_KAFKA_COMMIT), "Error in commit"); sendAmqpError(condition); } }
private void internalHandlerError(Exception e) { log.warn(e.getMessage(), e); ErrorCondition error = new ErrorCondition(); error.setCondition(AmqpError.INTERNAL_ERROR); error.setDescription("Unrecoverable error: " + (e.getMessage() == null ? e.getClass().getSimpleName() : e.getMessage())); connection.setCondition(error); connection.close(); flush(); }
@Override public void disconnect(boolean criticalError) { ErrorCondition errorCondition = new ErrorCondition(); errorCondition.setCondition(AmqpSupport.CONNECTION_FORCED); amqpConnection.close(errorCondition); // There's no need to flush, amqpConnection.close() is calling flush // as long this semantic is kept no need to flush here }
/** * Convert this exception into an {@code ErrorCondition}. */ public ErrorCondition toCondition() { return new ErrorCondition(Symbol.getSymbol(this.error), getMessage()); }
@Override public void onError(int errorCode, String errorMessage) { connection.runNow(() -> { receiver.setCondition(new ErrorCondition(AmqpError.ILLEGAL_STATE, errorCode + ":" + errorMessage)); connection.flush(); }); } });
/** * Called when the Broker sends a ConsumerControl command to the Consumer that * this sender creates to obtain messages to dispatch via the sender for this * end of the open link. * * @param control * The ConsumerControl command to process. */ public void onConsumerControl(ConsumerControl control) { if (control.isClose()) { close(new ErrorCondition(AmqpError.INTERNAL_ERROR, "Receiver forcably closed")); session.pumpProtonToSocket(); } }
@Override public int sendMessage(MessageReference ref, Message message, ServerConsumer consumer, int deliveryCount) { ProtonServerSenderContext plugSender = (ProtonServerSenderContext) consumer.getProtocolContext(); try { return plugSender.deliverMessage(ref, consumer); } catch (Exception e) { connection.runNow(() -> { plugSender.getSender().setCondition(new ErrorCondition(AmqpError.INTERNAL_ERROR, e.getMessage())); connection.flush(); }); throw new IllegalStateException("Can't deliver message " + e, e); } }
private Rejected createRejected(Symbol amqpError, String message) { Rejected rejected = new Rejected(); ErrorCondition condition = new ErrorCondition(); condition.setCondition(amqpError); condition.setDescription(message); rejected.setError(condition); return rejected; }
@Override public void disconnect(boolean criticalError) { ErrorCondition errorCondition = new ErrorCondition(); errorCondition.setCondition(AmqpSupport.CONNECTION_FORCED); amqpConnection.close(errorCondition); getTransportConnection().close(); }
private Rejected createRejected(Symbol amqpError, String message) { Rejected rejected = new Rejected(); ErrorCondition condition = new ErrorCondition(); condition.setCondition(amqpError); condition.setDescription(message); rejected.setError(condition); return rejected; }
private Rejected createRejected(Symbol amqpError, String message) { Rejected rejected = new Rejected(); ErrorCondition condition = new ErrorCondition(); condition.setCondition(amqpError); condition.setDescription(message); rejected.setError(condition); return rejected; }
@Override public void onError(int errorCode, String errorMessage) { connection.lock(); try { receiver.setCondition(new ErrorCondition(AmqpError.ILLEGAL_STATE, errorCode + ":" + errorMessage)); connection.flush(); } finally { connection.unlock(); } } });
@Override public void disconnect(ServerConsumer consumer, SimpleString queueName) { ErrorCondition ec = new ErrorCondition(AmqpSupport.RESOURCE_DELETED, "Queue was deleted: " + queueName); connection.runNow(() -> { try { ((ProtonServerSenderContext) consumer.getProtocolContext()).close(ec); connection.flush(); } catch (ActiveMQAMQPException e) { logger.error("Error closing link for " + consumer.getQueue().getAddress()); } }); }
@Override public void disconnect(ServerConsumer consumer, SimpleString queueName) { ErrorCondition ec = new ErrorCondition(AmqpSupport.RESOURCE_DELETED, "Queue was deleted: " + queueName); connection.lock(); try { ((ProtonServerSenderContext) consumer.getProtocolContext()).close(ec); connection.flush(); } catch (ActiveMQAMQPException e) { logger.error("Error closing link for " + consumer.getQueue().getAddress()); } finally { connection.unlock(); } }