From 2abc867a672c4b15c1bb1e5a71c099746dc77b6f Mon Sep 17 00:00:00 2001 From: aoshiguchen <1052045476@qq.com> Date: Wed, 28 Sep 2022 23:21:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0event=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E7=B1=BB=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/base/event/ApplicationEvent.java | 68 +++++++++++++++++ .../base/event/ApplicationEventContext.java | 29 +++++++ .../base/event/ApplicationEventSource.java | 30 ++++++++ .../asgc/neutrino/core/base/event/Event.java | 75 +++++++++++++++++++ .../core/base/event/EventContext.java | 30 ++++++++ .../neutrino/core/base/event/EventMarket.java | 30 ++++++++ .../core/base/event/EventPublisher.java | 30 ++++++++ .../neutrino/core/base/event/EventSource.java | 30 ++++++++ 8 files changed, 322 insertions(+) create mode 100644 neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEvent.java create mode 100644 neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEventContext.java create mode 100644 neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEventSource.java create mode 100644 neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/Event.java create mode 100644 neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventContext.java create mode 100644 neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventMarket.java create mode 100644 neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventPublisher.java create mode 100644 neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventSource.java diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEvent.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEvent.java new file mode 100644 index 00000000..66f9c7c4 --- /dev/null +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEvent.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.core.base.event; + +import java.util.Map; +import java.util.Set; + +/** + * @author: aoshiguchen + * @date: 2022/9/28 + */ +public class ApplicationEvent implements Event { + + @Override + public ApplicationEventSource source() { + return null; + } + + @Override + public D data() { + return null; + } + + @Override + public ApplicationEventContext context() { + return null; + } + + @Override + public String topic() { + return null; + } + + @Override + public Set tags() { + return null; + } + + @Override + public Map attachData() { + return null; + } + + @Override + public String id() { + return null; + } + +} diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEventContext.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEventContext.java new file mode 100644 index 00000000..ee7df041 --- /dev/null +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEventContext.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.core.base.event; + +/** + * @author: aoshiguchen + * @date: 2022/9/28 + */ +public class ApplicationEventContext implements EventContext { +} diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEventSource.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEventSource.java new file mode 100644 index 00000000..a660e80b --- /dev/null +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/ApplicationEventSource.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.core.base.event; + +/** + * @author: aoshiguchen + * @date: 2022/9/28 + */ +public class ApplicationEventSource implements EventSource { + +} diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/Event.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/Event.java new file mode 100644 index 00000000..103eb6ae --- /dev/null +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/Event.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.core.base.event; + +import java.util.Map; +import java.util.Set; + +/** + * @author: aoshiguchen + * @date: 2022/9/28 + */ +public interface Event { + /** + * 获取事件源 + * @return 事件源 + */ + S source(); + + /** + * 获取数据 + * @return 数据 + */ + D data(); + + /** + * 获取事件上下文 + * @return 上下文 + */ + C context(); + + /** + * 事件主题 + * 用于订阅一级过滤 + * @return 主题 + */ + String topic(); + + /** + * 事件标签 + * 用于订阅二级过滤 + * @return 标签 + */ + Set tags(); + + /** + * 附加数据 + * @return 附加数据 + */ + Map attachData(); + + /** + * 事件ID + * @return 事件ID + */ + String id(); +} diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventContext.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventContext.java new file mode 100644 index 00000000..8d99b577 --- /dev/null +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventContext.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.core.base.event; + +/** + * @author: wen.y + * @date: 2022/9/28 + */ +public interface EventContext { + +} diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventMarket.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventMarket.java new file mode 100644 index 00000000..d8bb134f --- /dev/null +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventMarket.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.core.base.event; + +/** + * @author: aoshiguchen + * @date: 2022/9/28 + */ +public interface EventMarket { + +} diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventPublisher.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventPublisher.java new file mode 100644 index 00000000..4d212302 --- /dev/null +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventPublisher.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.core.base.event; + +/** + * @author: aoshiguchen + * @date: 2022/9/28 + */ +public interface EventPublisher { + +} diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventSource.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventSource.java new file mode 100644 index 00000000..678d9d2c --- /dev/null +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/base/event/EventSource.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.core.base.event; + +/** + * @author: aoshiguchen + * @date: 2022/9/28 + */ +public interface EventSource { + +}