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; } }
protected static void invokeDefaultErrorHandlers(final Throwable throwable) { MessageBuilder.createMessage(DefaultErrorCallback.CLIENT_ERROR_SUBJECT).signalling() .with(MessageParts.Throwable, throwable).defaultErrorHandling().sendNowWith(ErraiBus.get()); } }
.with(MessageParts.AdditionalDetails, a.toString()) .with(MessageParts.Throwable, e) .noErrorHandling().sendNowWith(ErraiBus.get()); .with(MessageParts.ErrorMessage, "Null exception reference") .with(MessageParts.AdditionalDetails, "No additional details") .noErrorHandling().sendNowWith(ErraiBus.get());
private void notifyPendingClients() { MessageBuilder.createMessage() .toSubject(subject) .command(ShoutboxCmd.SUBMIT_OFFER) .with(ShoutboxCmdParts.SUBJECT, subject) .with(ShoutboxCmdParts.PROVIDER, provider) .noErrorHandling().sendNowWith(bus); matchedClients.addAll(pendingClients); pendingClients.clear(); }
public void onClick(ClickEvent event) { createMessage() .toSubject((String) instanceProperties.get(LayoutParts.Subject.name())) .noErrorHandling().sendNowWith(ErraiBus.get()); window.hide(); } });
public void onClick(ClickEvent clickEvent) { MessageBuilder.createMessage() .toSubject("AuthenticationService") .command(SecurityCommands.EndSession) .noErrorHandling().sendNowWith(ErraiBus.get()); } }
protected static void invokeDefaultErrorHandlers(final Throwable throwable) { MessageBuilder.createMessage(DefaultErrorCallback.CLIENT_ERROR_SUBJECT).signalling() .with(MessageParts.Throwable, throwable).defaultErrorHandling().sendNowWith(ErraiBus.get()); } }
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, 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) { 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); } }
public void submitOffer(String provider, String subjectMatter) { createMessage() .toSubject(ShoutboxModule.INBOX) .command(ShoutboxCmd.SUBMIT_OFFER) .with(ShoutboxCmdParts.SUBJECT, subjectMatter) .with(ShoutboxCmdParts.PROVIDER, provider) .noErrorHandling().sendNowWith(bus); }
public void onClose(CloseEvent closeEvent) { createMessage() .toSubject("org.jboss.errai.WorkspaceLayout") .command(LayoutCommands.CloseTab) .with(LayoutParts.InstanceID, instanceId) .noErrorHandling().sendNowWith(ErraiBus.get()); }
public void retractOffer(String provider, String subjectMatter) { createMessage() .toSubject(ShoutboxModule.INBOX) .command(ShoutboxCmd.RETIRE_OFFER) .with(ShoutboxCmdParts.SUBJECT, subjectMatter) .with(ShoutboxCmdParts.PROVIDER, provider) .noErrorHandling().sendNowWith(bus); }
public void retireOffer(String client, String subjectMatter) { MessageBuilder.createMessage() .toSubject(ShoutboxModule.INBOX) .command(ShoutboxCmd.RETIRE_OFFER) .with(ShoutboxCmdParts.SUBJECT, subjectMatter) .with(ShoutboxCmdParts.CLIENT, client) .noErrorHandling() .sendNowWith(bus); } }
public void closeTab(String instanceId) { MessageBuilder.createMessage() .toSubject(getInstanceSubject(instanceId)) .command(LayoutCommands.CloseTab) .with(LayoutParts.InstanceID, instanceId) .noErrorHandling().sendNowWith(ErraiBus.get()); }
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()); }
public void onClick(ClickEvent clickEvent) { Log.debug("ToolID: "+ tool.getId()); MessageBuilder.createMessage() .toSubject(Workspace.SUBJECT) .command(LayoutCommands.ActivateTool) .with(LayoutParts.TOOL, tool.getId()) .with(LayoutParts.TOOLSET, toolSetId) .noErrorHandling() .sendNowWith(ErraiBus.get()); } }
public static Subscription subscribe(final String eventType, final AbstractCDIEventCallback<?> callback) { if (isRemoteCommunicationEnabled() && ErraiBus.get() instanceof ClientMessageBusImpl && ((ClientMessageBusImpl) ErraiBus.get()).getState().equals(BusState.CONNECTED)) { MessageBuilder.createMessage() .toSubject(CDI.SERVER_DISPATCHER_SUBJECT) .command(CDICommands.RemoteSubscribe) .with(CDIProtocol.BeanType, eventType) .with(CDIProtocol.Qualifiers, callback.getQualifiers()) .noErrorHandling().sendNowWith(ErraiBus.get()); } return subscribeLocal(eventType, callback, false); }
public static Subscription subscribe(final String eventType, final AbstractCDIEventCallback<?> callback) { if (isRemoteCommunicationEnabled() && ErraiBus.get() instanceof ClientMessageBusImpl && ((ClientMessageBusImpl) ErraiBus.get()).getState().equals(BusState.CONNECTED)) { MessageBuilder.createMessage() .toSubject(CDI.SERVER_DISPATCHER_SUBJECT) .command(CDICommands.RemoteSubscribe) .with(CDIProtocol.BeanType, eventType) .with(CDIProtocol.Qualifiers, callback.getQualifiers()) .noErrorHandling().sendNowWith(ErraiBus.get()); } return subscribeLocal(eventType, callback, false); }