Package com.streamreduce.core.model

Examples of com.streamreduce.core.model.Event


        connectionDAO.save(connection);

        decryptCredentials(connection);

        // Create the event stream entry
        Event event = eventService.createEvent(EventId.CREATE, connection, null);

        // Create message
        messageService.sendConnectionMessage(event, connection);

        return connection;
View Full Code Here


        decryptCredentials(connection);

        if (!silentUpdate) {
            // Create the event stream entry
            Event event = eventService.createEvent(EventId.UPDATE, connection, null);

            // Create message
            messageService.sendConnectionMessage(event, connection);
        }
View Full Code Here

    }

    public void deleteConnection(Connection connection) {
        deleteConnectionInventory(connection.getId());

        Event event = eventService.createEvent(EventId.DELETE, connection, null);
        messageService.sendConnectionMessage(event, connection);

        connectionDAO.delete(connection);
    }
View Full Code Here

            eventContext.put("addedHashtag", tag);
        } else if (eventId == EventId.HASHTAG_DELETE) {
            eventContext.put("deletedHashtag", tag);
        }

        Event event = eventService.createEvent(eventId, target, eventContext);

        // Create the message
        // TODO: Should this use MessageService#sendConnectionMessage(Event, Connection)?
        messageService.sendAccountMessage(event, tagger, target, new Date().getTime(),
                MessageType.CONNECTION, target.getHashtags(), null);
View Full Code Here

                                }

                                ObjectId originalTargetId = extraMetadata.get("messageEventTargetId") != null ?
                                        (ObjectId)extraMetadata.get("messageEventTargetId") :
                                        null;
                                Event previousEvent = getLastEventForTarget(originalTargetId);

                                // Try to get the user
                                ObjectId originalEventUserId = extraMetadata.get("messageEventUserId") != null ?
                                        (ObjectId)extraMetadata.get("messageEventUserId") :
                                        null;

                                if (originalEventUserId != null) {
                                    try {
                                        user = userService.getUserById(originalEventUserId);
                                    } catch (UserNotFoundException unfe) {
                                        if (previousEvent != null) {
                                            try {
                                                user = userService.getUserById(previousEvent.getUserId());
                                            } catch (UserNotFoundException unfe2) {
                                                // There is nothing we can do at this point.  Let's log so we can keep
                                                // track of these unrecoverable events
                                                logger.error("Unable to identify the sender of the SobaMessage " +
                                                                     "having an id of " + target.getId());
                                            }
                                        }
                                    }
                                }

                                // Try to get the account
                                ObjectId originalEventAccountId = extraMetadata.get("messageEventAccountId") != null ?
                                        (ObjectId)extraMetadata.get("messageEventAccountId") :
                                        null;

                                if (originalEventAccountId != null) {
                                    try {
                                        account = userService.getAccount(originalEventAccountId);
                                    } catch (AccountNotFoundException anfe) {
                                        if (previousEvent != null) {
                                            try {
                                                account = userService.getAccount(previousEvent.getAccountId());
                                            } catch (AccountNotFoundException anfe2) {
                                                // There is nothing we can do at this point.  Let's log so we can
                                                // keep track of these unrecoverable events
                                                logger.error("Unable to identify the sender of the SobaMessage " +
                                                                     "having an id of " + target.getId());
View Full Code Here

                                                             Constants.INVENTORY_ITEM_METADATA_COLLECTION_NAME,
                                                             inventoryItem.getMetadataId());

            if (cMetadata == null) {
                // Fill in the metadata based on the last event for this target
                Event previousEvent = getLastEventForTarget(inventoryItem.getId());

                if (previousEvent != null) {
                    Map<String, Object> peMetadata = previousEvent.getMetadata();

                    if (peMetadata != null) {
                        civMetadata.put("targetIP", peMetadata.get("targetIP"));
                        civMetadata.put("targetOS", peMetadata.get("targetOS"));
                        civMetadata.put("targetISO3166Code", peMetadata.get("targetISO3166Code"));
View Full Code Here

            Map<String, Object> eventContext = new HashMap<>();
            // Persist the full payload
            eventContext.put("message", message);
            eventContext.put("dateGenerated", dateGenerated);
            eventContext.put("payload", entry);
            Event event = eventService.createEvent(EventId.ACTIVITY, target, eventContext);

            if (message != null) {
                if (inventoryItem != null) {
                    messageService.sendGatewayMessage(event, inventoryItem, dateGenerated.getTime());
                } else {
View Full Code Here

            eventMetadata.put("messageHashtags", hashtags);
            eventMetadata.put("payload", json);
            eventMetadata.put("senderId", sender.getId());
            eventMetadata.put("senderAccountId", sender.getAccount().getId());

            Event event = applicationManager.getEventService().createEvent(EventId.CREATE_GLOBAL_MESSAGE,
                    null, eventMetadata);

            applicationManager.getMessageService().sendNodebellyGlobalMessage(event, sender, null, new Date().getTime(),
                    MessageType.SYSTEM, hashtags);
        } catch (UserNotFoundException e) {
View Full Code Here

                    eventContext.put("activityPayload", metric);

                    inventoryItem.addHashtag("agent");

                    // Create the event stream entry
                    Event event = applicationManager.getEventService().createEvent(EventId.ACTIVITY,
                                                                                   inventoryItem,
                                                                                   eventContext);

                    // create the message
                    // note: all messages will have the #agent tag now.
View Full Code Here

            Map<String, Object> eventMetadata = new HashMap<>();
            eventMetadata.put("message", message);
            eventMetadata.put("payload", json);

            Event event = applicationManager.getEventService().createEvent(EventId.CREATE_GLOBAL_MESSAGE, null,
                    eventMetadata);

            applicationManager.getMessageService().sendNodeableAccountMessage(event, account, hashtags);

        } catch (AccountNotFoundException e) {
View Full Code Here

TOP

Related Classes of com.streamreduce.core.model.Event

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.