diff --git a/sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/readmodels/ReadModelCapability.java b/sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/readmodels/ReadModelCapability.java index 43b25b6..3f928f1 100644 --- a/sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/readmodels/ReadModelCapability.java +++ b/sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/readmodels/ReadModelCapability.java @@ -25,10 +25,4 @@ public interface ReadModelCapability { T read ( Class> readModelClass, Object... params ); - // TODO how to hide these from other clients than the Dashboard? - - T readUnbounded ( Class> readModelClass, Tracing tracing, Object... params ); - - T readUnbounded ( Class> readModelClass, Object... params ); - } diff --git a/sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/readmodels/UnboundedReadModelCapability.java b/sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/readmodels/UnboundedReadModelCapability.java new file mode 100644 index 0000000..fdb2bb8 --- /dev/null +++ b/sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/readmodels/UnboundedReadModelCapability.java @@ -0,0 +1,41 @@ +/* + * Sliceworkz Event Modeling - an opinionated Event Modeling framework in Java + * Copyright © 2025 Sliceworkz / XTi (info@sliceworkz.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +package org.sliceworkz.eventmodeling.readmodels; + +import org.sliceworkz.eventmodeling.events.Tracing; + +/** + * Capability for reading models across all event streams, regardless of bounded context boundaries. + *

+ * This is intended for internal dashboard and monitoring use only. + * Application developers should use {@link ReadModelCapability#read} instead, + * which scopes queries to the bounded context's own domain event stream. + *

+ * To use this capability, define a custom bounded context interface that explicitly + * extends this interface: + *

{@code
+ * interface DashboardContext extends CQRSCapabilities, UnboundedReadModelCapability {}
+ * }
+ */ +public interface UnboundedReadModelCapability { + + T readUnbounded ( Class> readModelClass, Tracing tracing, Object... params ); + + T readUnbounded ( Class> readModelClass, Object... params ); + +} diff --git a/sliceworkz-eventmodeling-impl/src/main/java/org/sliceworkz/eventmodeling/module/boundedcontext/BoundedContextImpl.java b/sliceworkz-eventmodeling-impl/src/main/java/org/sliceworkz/eventmodeling/module/boundedcontext/BoundedContextImpl.java index dd890d6..fd2047a 100644 --- a/sliceworkz-eventmodeling-impl/src/main/java/org/sliceworkz/eventmodeling/module/boundedcontext/BoundedContextImpl.java +++ b/sliceworkz-eventmodeling-impl/src/main/java/org/sliceworkz/eventmodeling/module/boundedcontext/BoundedContextImpl.java @@ -41,6 +41,7 @@ import org.sliceworkz.eventmodeling.module.outbound.OutboundModule; import org.sliceworkz.eventmodeling.module.readmodels.ReadModelModule; import org.sliceworkz.eventmodeling.readmodels.ReadModelWithMetaData; +import org.sliceworkz.eventmodeling.readmodels.UnboundedReadModelCapability; import org.sliceworkz.eventmodeling.slices.FeatureSliceConfiguration; import org.sliceworkz.eventstore.events.EphemeralEvent; import org.sliceworkz.eventstore.events.Event; @@ -52,7 +53,7 @@ import io.micrometer.core.instrument.Counter; import io.micrometer.core.instrument.MeterRegistry; -public class BoundedContextImpl implements AllCapabilities, ConsistentEventProcessor { +public class BoundedContextImpl implements AllCapabilities, UnboundedReadModelCapability, ConsistentEventProcessor { private static final Logger LOGGER = LoggerFactory.getLogger(BoundedContextImpl.class);