private byte[] synchronousRequest( ConnectorSession session, ConnectorProducer producer, ConnectorMessage m) throws BCSAPIException { ConnectorTemporaryQueue answerQueue = null; try { answerQueue = session.createTemporaryQueue(); m.setReplyTo(answerQueue); try (ConnectorConsumer consumer = session.createConsumer(answerQueue)) { producer.send(m); ConnectorMessage reply = consumer.receive(clientSettings.getTimeout()); if (reply == null) { throw new BCSAPIException("timeout"); } return reply.getPayload(); } } catch (ConnectorException e) { throw new BCSAPIException(e); } finally { try { if (answerQueue != null) { answerQueue.delete(); } } catch (ConnectorException e) { } } }
public BCSAPIClient(ConnectorFactory connectionFactory) { this(connectionFactory, HyperLedgerSettings.getInstance()); }