Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit StreamsChangedEvent and StreamDeletedEvent in BundleImporter #3848

Merged
merged 1 commit into from May 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -19,6 +19,7 @@
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import org.bson.types.ObjectId;
import org.graylog2.dashboards.DashboardImpl;
import org.graylog2.dashboards.DashboardService;
Expand Down Expand Up @@ -53,6 +54,8 @@
import org.graylog2.streams.StreamRuleImpl;
import org.graylog2.streams.StreamRuleService;
import org.graylog2.streams.StreamService;
import org.graylog2.streams.events.StreamDeletedEvent;
import org.graylog2.streams.events.StreamsChangedEvent;
import org.graylog2.timeranges.TimeRangeFactory;
import org.joda.time.DateTime;
import org.slf4j.Logger;
Expand Down Expand Up @@ -225,8 +228,10 @@ private void deleteCreatedOutputs() throws NotFoundException {

private void deleteCreatedStreams() throws NotFoundException {
for (Map.Entry<String, org.graylog2.plugin.streams.Stream> entry : createdStreams.entrySet()) {
LOG.debug("Deleting stream {} from database", entry.getKey());
final String streamId = entry.getKey();
LOG.debug("Deleting stream {} from database", streamId);
streamService.destroy(entry.getValue());
clusterBus.post(streamId);
}
}

Expand Down Expand Up @@ -465,6 +470,9 @@ private void createStreams(final String bundleId, final Set<Stream> streams, fin
streamsByReferenceId.put(referenceId, stream);
}
}

final ImmutableSet<String> streamIds = ImmutableSet.copyOf(createdStreams.keySet());
clusterBus.post(StreamsChangedEvent.create(streamIds));
}

private org.graylog2.plugin.streams.Stream createStream(final String bundleId, final Stream streamDescription, final String userName)
Expand Down