@Override public void setValue(final T responseValue) { createConversation(incomingMessage) .subjectProvided() .with("MethodReply", responseValue) .noErrorHandling().reply(); } }
public static void sendClientError(MessageBus bus, String queueId, String errorMessage, String additionalDetails) { try { MessageBuilder.createMessage() .toSubject(DefaultErrorCallback.CLIENT_ERROR_SUBJECT) .with("ErrorMessage", errorMessage) .with("AdditionalDetails", additionalDetails) .with(MessageParts.SessionID, queueId) .flag(RoutingFlag.NonGlobalRouting) .noErrorHandling().sendNowWith(bus); } catch (RuntimeException e) { // note: this is handled this way, because this is shared server and client code. if (e.getClass().getName().equals("org.jboss.errai.bus.server.QueueUnavailableException")) { // ignore. } throw e; } }
.with(MessageParts.ErrorMessage, e.getMessage()) .with(MessageParts.AdditionalDetails, a.toString()) .with(MessageParts.Throwable, e) createConversation(message) .toSubject(CLIENT_ERROR_SUBJECT) .with(MessageParts.ErrorMessage, e.getMessage()) .with(MessageParts.AdditionalDetails, a.toString()) .with(MessageParts.Throwable, e) if (message == null) { createMessage(CLIENT_ERROR_SUBJECT) .with(MessageParts.ErrorMessage, "Null exception reference") .with(MessageParts.AdditionalDetails, "No additional details") .noErrorHandling().sendNowWith(ErraiBus.get()); createConversation(message) .toSubject(CLIENT_ERROR_SUBJECT) .with(MessageParts.ErrorMessage, "Null exception reference") .with(MessageParts.AdditionalDetails, "No additional details") .noErrorHandling().reply();
@Override public void callback(final Message message) { createConversation(message) .subjectProvided() .with("MethodReply", invokeMethodFromMessage(message)) .noErrorHandling().sendNowWith(bus); } }
.with("ErrorMessage", errorMessage) .with("AdditionalDetails", additionalDetails) .with(MessageParts.ErrorTo, message.get(String.class, MessageParts.ErrorTo))
@Override public void setValue(final T responseValue) { createConversation(incomingMessage) .subjectProvided() .with("MethodReply", responseValue) .noErrorHandling().reply(); } }
public static void sendClientError(MessageBus bus, String queueId, String errorMessage, String additionalDetails) { try { MessageBuilder.createMessage() .toSubject(DefaultErrorCallback.CLIENT_ERROR_SUBJECT) .with("ErrorMessage", errorMessage) .with("AdditionalDetails", additionalDetails) .with(MessageParts.SessionID, queueId) .flag(RoutingFlag.NonGlobalRouting) .noErrorHandling().sendNowWith(bus); } catch (RuntimeException e) { // note: this is handled this way, because this is shared server and client code. if (e.getClass().getName().equals("org.jboss.errai.bus.server.QueueUnavailableException")) { // ignore. } throw e; } }
.with(MessageParts.ErrorMessage, e.getMessage()) .with(MessageParts.AdditionalDetails, a.toString()) .with(MessageParts.Throwable, e) createConversation(message) .toSubject(CLIENT_ERROR_SUBJECT) .with(MessageParts.ErrorMessage, e.getMessage()) .with(MessageParts.AdditionalDetails, a.toString()) .with(MessageParts.Throwable, e) if (message == null) { createMessage(CLIENT_ERROR_SUBJECT) .with(MessageParts.ErrorMessage, "Null exception reference") .with(MessageParts.AdditionalDetails, "No additional details") .noErrorHandling().sendNowWith(ErraiBus.get()); createConversation(message) .toSubject(CLIENT_ERROR_SUBJECT) .with(MessageParts.ErrorMessage, "Null exception reference") .with(MessageParts.AdditionalDetails, "No additional details") .noErrorHandling().reply();
@Override public void callback(final Message message) { createConversation(message) .subjectProvided() .with("MethodReply", invokeMethodFromMessage(message)) .noErrorHandling().sendNowWith(bus); } }
public void run() { createMessage() .toSubject("AuthorizationService") .with(MessageParts.ReplyTo, "AuthorizationListener") .noErrorHandling().sendNowWith(ErraiBus.get()); } };
@Override public void send(T value) { if (replyTo != null) { MessageBuilder.createMessage() .toSubject(toSubject) .with(MessageParts.ReplyTo, replyTo) .with(MessageParts.Value, value) .done().sendNowWith(messageBus); } else { MessageBuilder.createMessage() .toSubject(toSubject) .with(MessageParts.Value, value) .done().sendNowWith(messageBus); } }
@Override public void send(T value) { if (replyTo != null) { MessageBuilder.createMessage() .toSubject(toSubject) .with(MessageParts.ReplyTo, replyTo) .with(MessageParts.Value, value) .done().sendNowWith(messageBus); } else { MessageBuilder.createMessage() .toSubject(toSubject) .with(MessageParts.Value, value) .done().sendNowWith(messageBus); } }
@Override public void send(T value, ErrorCallback errorCallback) { if (replyTo != null) { MessageBuilder.createMessage() .toSubject(toSubject) .with(MessageParts.ReplyTo, replyTo) .with(MessageParts.Value, value) .errorsHandledBy(errorCallback) .sendNowWith(messageBus); } else { MessageBuilder.createMessage() .toSubject(toSubject) .with(MessageParts.Value, value) .errorsHandledBy(errorCallback) .sendNowWith(messageBus); } }
@Override public void send(T value, ErrorCallback errorCallback) { if (replyTo != null) { MessageBuilder.createMessage() .toSubject(toSubject) .with(MessageParts.ReplyTo, replyTo) .with(MessageParts.Value, value) .errorsHandledBy(errorCallback) .sendNowWith(messageBus); } else { MessageBuilder.createMessage() .toSubject(toSubject) .with(MessageParts.Value, value) .errorsHandledBy(errorCallback) .sendNowWith(messageBus); } }
.with("ErrorMessage", errorMessage) .with("AdditionalDetails", additionalDetails) .with(MessageParts.ErrorTo, message.get(String.class, MessageParts.ErrorTo))
public static void hintAll() { LayoutHintProvider p; for (String s : MANAGED_SUBJECTS.keySet()) { if ((p = findProvider(s)) != null && p.getWidthHint() > 0 && p.getHeightHint() > 0) { MessageBuilder.createMessage() .toSubject(s) .with(LayoutParts.Width, p.getWidthHint()) .with(LayoutParts.Height, p.getHeightHint()) .noErrorHandling().sendNowWith(ErraiBus.get()); } } for (Widget w : MANAGED_WIDGETS.keySet()) { p = findProvider(w); if (p != null && w.isAttached() && p.getWidthHint() > 0 && p.getHeightHint() > 0) { w.setPixelSize(p.getWidthHint(), p.getHeightHint()); } } } }
private void notifyWorkspace() { MessageBuilder.createMessage() .toSubject(Workspace.SUBJECT) .command(LayoutCommands.Initialize) .noErrorHandling().sendNowWith(ErraiBus.get()); AuthenticationContext authenticationContext = Registry.get(SecurityService.class).getAuthenticationContext(); String userName = authenticationContext != null ? authenticationContext.getName() : "NoAuthentication"; MessageBuilder.createMessage() .toSubject("appContext.login") .with("username", userName) .noErrorHandling() .sendNowWith(ErraiBus.get()); }