/** Sets the destination. Used by message cancellation test. */ public void setNonBlockingSenderDestination(final String uriStr) { final MessageListener responseListener = new DestinationListener("Cancellation Listener", true); try { final URI uri = URI.create(uriStr); SenderDestination destination = DestinationFactory.getSenderDestination(_context.getName(), uri); if (destination == null) { // Destination not registered yet destination = DestinationFactory.createNonBlockingSenderDestination(_context, uri, responseListener); } _cancellationDest = (NonBlockingSenderDestination) destination; } catch (final Exception e) { alertDialog(e.toString()); } }
/** * Sends message to the URI using FireAndForget destination * * @param uriSenderStr Sender destination URI */ public void sendFireForget(final String uriSenderStr) { FireAndForgetDestination fireForgetDest = null; try { fireForgetDest = (FireAndForgetDestination) DestinationFactory.getSenderDestination(_context.getName(), URI.create(uriSenderStr)); if (fireForgetDest == null) { fireForgetDest = DestinationFactory.createFireAndForgetDestination(_context, URI.create(uriSenderStr)); } final int msgId = fireForgetDest.sendNoResponse(); alertDialog("Message [id:" + msgId + "] has been sent!"); } catch (final Exception e) { alertDialog(e.toString()); } }