This is an automated email from the ASF dual-hosted git repository.
lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 5ab973c Observe Camel's Lifecycle events #1399
5ab973c is described below
commit 5ab973cc9950b2272af2a78023703194d488f40f
Author: lburgazzoli <[email protected]>
AuthorDate: Mon Jun 22 11:08:35 2020 +0200
Observe Camel's Lifecycle events #1399
---
.../quarkus/core/runtime/CamelObserversTest.java | 51 ++++++++--
.../camel/quarkus/core/CamelContextRecorder.java | 1 +
.../quarkus/core/CamelLifecycleEventBridge.java | 110 +++++++++++++++++++++
.../quarkus/core/events/ComponentAddEvent.java | 25 +++++
.../camel/quarkus/core/events/ComponentEvent.java | 47 +++++++++
.../quarkus/core/events/ComponentRemoveEvent.java | 25 +++++
.../quarkus/core/events/EndpointAddEvent.java | 25 +++++
.../camel/quarkus/core/events/EndpointEvent.java | 47 +++++++++
.../quarkus/core/events/EndpointRemoveEvent.java | 25 +++++
.../quarkus/core/events/ErrorHandlerAddEvent.java | 27 +++++
.../quarkus/core/events/ErrorHandlerEvent.java | 52 ++++++++++
.../core/events/ErrorHandlerRemoveEvent.java | 27 +++++
.../camel/quarkus/core/events/ServiceAddEvent.java | 27 +++++
.../camel/quarkus/core/events/ServiceEvent.java | 58 +++++++++++
.../quarkus/core/events/ServiceRemoveEvent.java | 27 +++++
.../quarkus/core/events/ThreadPoolAddEvent.java | 54 ++++++++++
.../camel/quarkus/core/events/ThreadPoolEvent.java | 46 +++++++++
.../quarkus/core/events/ThreadPoolRemoveEvent.java | 27 +++++
18 files changed, 694 insertions(+), 7 deletions(-)
diff --git
a/extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/runtime/CamelObserversTest.java
b/extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/runtime/CamelObserversTest.java
index c9ecd4c..12a301a 100644
---
a/extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/runtime/CamelObserversTest.java
+++
b/extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/runtime/CamelObserversTest.java
@@ -26,20 +26,20 @@ import javax.inject.Inject;
import io.quarkus.test.QuarkusUnitTest;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.direct.DirectComponent;
import org.apache.camel.impl.event.RouteStartedEvent;
+import org.apache.camel.quarkus.core.events.ComponentAddEvent;
+import org.apache.camel.quarkus.core.events.EndpointAddEvent;
+import org.apache.camel.quarkus.core.events.ServiceAddEvent;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
public class CamelObserversTest {
- private static final Logger LOGGER =
LoggerFactory.getLogger(CamelObserversTest.class);
-
@RegisterExtension
static final QuarkusUnitTest CONFIG = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));
@@ -50,29 +50,66 @@ public class CamelObserversTest {
@Test
public void testObservers() {
await().atMost(10, TimeUnit.SECONDS).untilAsserted(() -> {
- assertThat(handler.routes()).contains("myRoute");
+ assertThat(handler.routes())
+ .contains(MyRoutes.ROUTE_ID);
+ assertThat(handler.components())
+ .contains(DirectComponent.class.getName());
+ assertThat(handler.endpoints())
+ .contains(MyRoutes.FROM_ENDPOINT);
+ assertThat(handler.service())
+ .isNotEmpty();
});
}
@ApplicationScoped
public static class EventHandler {
private final Set<String> routes = new CopyOnWriteArraySet<>();
+ private final Set<String> endpoints = new CopyOnWriteArraySet<>();
+ private final Set<String> components = new CopyOnWriteArraySet<>();
+ private final Set<String> service = new CopyOnWriteArraySet<>();
public void onRouteStarted(@Observes RouteStartedEvent event) {
routes.add(event.getRoute().getRouteId());
}
+ public void onComponentAdd(@Observes ComponentAddEvent event) {
+ components.add(event.getComponent().getClass().getName());
+ }
+
+ public void onEndpointAdd(@Observes EndpointAddEvent event) {
+ endpoints.add(event.getEndpoint().getEndpointUri());
+ }
+
+ public void onServiceAdd(@Observes ServiceAddEvent event) {
+ service.add(event.getService().getClass().getName());
+ }
+
public Set<String> routes() {
return routes;
}
+
+ public Set<String> components() {
+ return components;
+ }
+
+ public Set<String> endpoints() {
+ return endpoints;
+ }
+
+ public Set<String> service() {
+ return service;
+ }
}
@ApplicationScoped
public static class MyRoutes extends RouteBuilder {
+ public static String ROUTE_ID = "myRoute";
+ public static String FROM_ENDPOINT = "direct://start";
+
@Override
public void configure() throws Exception {
- from("direct:start")
- .routeId("myRoute")
+ from(FROM_ENDPOINT)
+ .routeId(ROUTE_ID)
.log("${body}");
}
}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java
index f20b153..00d99da 100644
---
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java
@@ -54,6 +54,7 @@ public class CamelContextRecorder {
context.setLoadTypeConverters(false);
context.setModelJAXBContextFactory(contextFactory.getValue());
context.build();
+ context.addLifecycleStrategy(new CamelLifecycleEventBridge());
context.getManagementStrategy().addEventNotifier(new
CamelEventBridge());
// register to the container
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelLifecycleEventBridge.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelLifecycleEventBridge.java
new file mode 100644
index 0000000..e8c4603
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelLifecycleEventBridge.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import io.quarkus.arc.Arc;
+import io.quarkus.arc.ArcContainer;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.Endpoint;
+import org.apache.camel.ErrorHandlerFactory;
+import org.apache.camel.Processor;
+import org.apache.camel.Route;
+import org.apache.camel.Service;
+import org.apache.camel.quarkus.core.events.ComponentAddEvent;
+import org.apache.camel.quarkus.core.events.ComponentRemoveEvent;
+import org.apache.camel.quarkus.core.events.EndpointAddEvent;
+import org.apache.camel.quarkus.core.events.EndpointRemoveEvent;
+import org.apache.camel.quarkus.core.events.ErrorHandlerAddEvent;
+import org.apache.camel.quarkus.core.events.ErrorHandlerRemoveEvent;
+import org.apache.camel.quarkus.core.events.ServiceAddEvent;
+import org.apache.camel.quarkus.core.events.ServiceRemoveEvent;
+import org.apache.camel.quarkus.core.events.ThreadPoolAddEvent;
+import org.apache.camel.quarkus.core.events.ThreadPoolRemoveEvent;
+import org.apache.camel.spi.CamelEvent;
+import org.apache.camel.support.LifecycleStrategySupport;
+
+public class CamelLifecycleEventBridge extends LifecycleStrategySupport {
+ @Override
+ public void onComponentAdd(String name, Component component) {
+ fireEvent(new ComponentAddEvent(component));
+ }
+
+ @Override
+ public void onComponentRemove(String name, Component component) {
+ fireEvent(new ComponentRemoveEvent(component));
+ }
+
+ @Override
+ public void onEndpointAdd(Endpoint endpoint) {
+ fireEvent(new EndpointAddEvent(endpoint));
+ }
+
+ @Override
+ public void onEndpointRemove(Endpoint endpoint) {
+ fireEvent(new EndpointRemoveEvent(endpoint));
+ }
+
+ @Override
+ public void onErrorHandlerAdd(Route route, Processor errorHandler,
ErrorHandlerFactory errorHandlerFactory) {
+ fireEvent(new ErrorHandlerAddEvent(route, errorHandler,
errorHandlerFactory));
+ }
+
+ @Override
+ public void onErrorHandlerRemove(Route route, Processor errorHandler,
ErrorHandlerFactory errorHandlerFactory) {
+ fireEvent(new ErrorHandlerRemoveEvent(route, errorHandler,
errorHandlerFactory));
+ }
+
+ @Override
+ public void onThreadPoolAdd(CamelContext camelContext, ThreadPoolExecutor
threadPool, String id,
+ String sourceId, String routeId, String threadPoolProfileId) {
+ fireEvent(new ThreadPoolAddEvent(camelContext, threadPool, id,
sourceId, routeId, threadPoolProfileId));
+ }
+
+ @Override
+ public void onThreadPoolRemove(CamelContext camelContext,
ThreadPoolExecutor threadPool) {
+ fireEvent(new ThreadPoolRemoveEvent(camelContext, threadPool));
+ }
+
+ @Override
+ public void onServiceAdd(CamelContext context, Service service,
org.apache.camel.Route route) {
+ fireEvent(new ServiceAddEvent(context, service, route));
+ }
+
+ @Override
+ public void onServiceRemove(CamelContext context, Service service,
org.apache.camel.Route route) {
+ fireEvent(new ServiceRemoveEvent(context, service, route));
+ }
+
+ private static <T extends CamelEvent> void fireEvent(T event) {
+ fireEvent(CamelEvent.class, event);
+ }
+
+ private static <T> void fireEvent(Class<T> clazz, T event) {
+ ArcContainer container = Arc.container();
+ if (container != null) {
+ BeanManager beanManager = container.beanManager();
+ if (beanManager != null) {
+ beanManager.getEvent().select(clazz).fire(event);
+ }
+ }
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ComponentAddEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ComponentAddEvent.java
new file mode 100644
index 0000000..bf7d95b
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ComponentAddEvent.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.Component;
+
+public class ComponentAddEvent extends ComponentEvent {
+ public ComponentAddEvent(Component component) {
+ super(component);
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ComponentEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ComponentEvent.java
new file mode 100644
index 0000000..6ca3ae3
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ComponentEvent.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.spi.CamelEvent;
+
+public class ComponentEvent implements CamelEvent.CamelContextEvent {
+ private final Component component;
+
+ public ComponentEvent(Component component) {
+ this.component = component;
+ }
+
+ @Override
+ public CamelContext getContext() {
+ return this.component.getCamelContext();
+ }
+
+ public Component getComponent() {
+ return this.component;
+ }
+
+ public <T extends Component> T getComponent(Class<T> type) {
+ return type.cast(this.component);
+ }
+
+ @Override
+ public Type getType() {
+ return Type.Custom;
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ComponentRemoveEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ComponentRemoveEvent.java
new file mode 100644
index 0000000..5605adf
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ComponentRemoveEvent.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.Component;
+
+public class ComponentRemoveEvent extends ComponentEvent {
+ public ComponentRemoveEvent(Component component) {
+ super(component);
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/EndpointAddEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/EndpointAddEvent.java
new file mode 100644
index 0000000..b3411c6
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/EndpointAddEvent.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.Endpoint;
+
+public class EndpointAddEvent extends EndpointEvent {
+ public EndpointAddEvent(Endpoint endpoint) {
+ super(endpoint);
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/EndpointEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/EndpointEvent.java
new file mode 100644
index 0000000..7a575ad
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/EndpointEvent.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.CamelEvent;
+
+public class EndpointEvent implements CamelEvent.CamelContextEvent {
+ private final Endpoint endpoint;
+
+ public EndpointEvent(Endpoint endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ @Override
+ public CamelContext getContext() {
+ return this.endpoint.getCamelContext();
+ }
+
+ public Endpoint getEndpoint() {
+ return this.endpoint;
+ }
+
+ public <T extends Endpoint> T getEndpoint(Class<T> type) {
+ return type.cast(this.endpoint);
+ }
+
+ @Override
+ public Type getType() {
+ return Type.Custom;
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/EndpointRemoveEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/EndpointRemoveEvent.java
new file mode 100644
index 0000000..8d2f0bc
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/EndpointRemoveEvent.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.Endpoint;
+
+public class EndpointRemoveEvent extends EndpointEvent {
+ public EndpointRemoveEvent(Endpoint endpoint) {
+ super(endpoint);
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ErrorHandlerAddEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ErrorHandlerAddEvent.java
new file mode 100644
index 0000000..d9d720c
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ErrorHandlerAddEvent.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.ErrorHandlerFactory;
+import org.apache.camel.Processor;
+import org.apache.camel.Route;
+
+public class ErrorHandlerAddEvent extends ErrorHandlerEvent {
+ public ErrorHandlerAddEvent(Route route, Processor errorHandler,
ErrorHandlerFactory errorHandlerFactory) {
+ super(route, errorHandler, errorHandlerFactory);
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ErrorHandlerEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ErrorHandlerEvent.java
new file mode 100644
index 0000000..e41f2ba
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ErrorHandlerEvent.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.ErrorHandlerFactory;
+import org.apache.camel.Processor;
+import org.apache.camel.Route;
+import org.apache.camel.spi.CamelEvent;
+
+public class ErrorHandlerEvent implements CamelEvent.RouteEvent {
+ private final Route route;
+ private final Processor errorHandler;
+ private final ErrorHandlerFactory errorHandlerFactory;
+
+ public ErrorHandlerEvent(Route route, Processor errorHandler,
ErrorHandlerFactory errorHandlerFactory) {
+ this.route = route;
+ this.errorHandler = errorHandler;
+ this.errorHandlerFactory = errorHandlerFactory;
+ }
+
+ @Override
+ public Route getRoute() {
+ return this.route;
+ }
+
+ public Processor getErrorHandler() {
+ return errorHandler;
+ }
+
+ public ErrorHandlerFactory getErrorHandlerFactory() {
+ return errorHandlerFactory;
+ }
+
+ @Override
+ public Type getType() {
+ return Type.Custom;
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ErrorHandlerRemoveEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ErrorHandlerRemoveEvent.java
new file mode 100644
index 0000000..937b053
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ErrorHandlerRemoveEvent.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.ErrorHandlerFactory;
+import org.apache.camel.Processor;
+import org.apache.camel.Route;
+
+public class ErrorHandlerRemoveEvent extends ErrorHandlerEvent {
+ public ErrorHandlerRemoveEvent(Route route, Processor errorHandler,
ErrorHandlerFactory errorHandlerFactory) {
+ super(route, errorHandler, errorHandlerFactory);
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ServiceAddEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ServiceAddEvent.java
new file mode 100644
index 0000000..ada8537
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ServiceAddEvent.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+import org.apache.camel.Service;
+
+public class ServiceAddEvent extends ServiceEvent {
+ public ServiceAddEvent(CamelContext camelContext, Service service, Route
route) {
+ super(camelContext, service, route);
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ServiceEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ServiceEvent.java
new file mode 100644
index 0000000..85c47ad
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ServiceEvent.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import java.util.Optional;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+import org.apache.camel.Service;
+import org.apache.camel.spi.CamelEvent;
+
+public class ServiceEvent implements CamelEvent.CamelContextEvent {
+ private final CamelContext camelContext;
+ private final Service service;
+ private final Route route;
+
+ public ServiceEvent(CamelContext camelContext, Service service, Route
route) {
+ this.camelContext = camelContext;
+ this.service = service;
+ this.route = route;
+ }
+
+ @Override
+ public CamelContext getContext() {
+ return this.camelContext;
+ }
+
+ public Service getService() {
+ return this.service;
+ }
+
+ public <T extends Service> T getService(Class<T> type) {
+ return type.cast(this.service);
+ }
+
+ public Optional<Route> getRoute() {
+ return Optional.ofNullable(route);
+ }
+
+ @Override
+ public Type getType() {
+ return Type.Custom;
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ServiceRemoveEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ServiceRemoveEvent.java
new file mode 100644
index 0000000..1f87f99
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ServiceRemoveEvent.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+import org.apache.camel.Service;
+
+public class ServiceRemoveEvent extends ServiceEvent {
+ public ServiceRemoveEvent(CamelContext camelContext, Service service,
Route route) {
+ super(camelContext, service, route);
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ThreadPoolAddEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ThreadPoolAddEvent.java
new file mode 100644
index 0000000..dfa3750
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ThreadPoolAddEvent.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import java.util.Optional;
+import java.util.concurrent.ThreadPoolExecutor;
+
+import org.apache.camel.CamelContext;
+
+public class ThreadPoolAddEvent extends ThreadPoolEvent {
+ private final String id;
+ private final String sourceId;
+ private final String routeId;
+ private final String threadPoolProfileId;
+
+ public ThreadPoolAddEvent(CamelContext camelContext, ThreadPoolExecutor
threadPool, String id, String sourceId,
+ String routeId, String threadPoolProfileId) {
+ super(camelContext, threadPool);
+ this.id = id;
+ this.sourceId = sourceId;
+ this.routeId = routeId;
+ this.threadPoolProfileId = threadPoolProfileId;
+ }
+
+ public Optional<String> getId() {
+ return Optional.ofNullable(id);
+ }
+
+ public Optional<String> getSourceId() {
+ return Optional.ofNullable(sourceId);
+ }
+
+ public Optional<String> getRouteId() {
+ return Optional.ofNullable(routeId);
+ }
+
+ public Optional<String> getThreadPoolProfileId() {
+ return Optional.ofNullable(threadPoolProfileId);
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ThreadPoolEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ThreadPoolEvent.java
new file mode 100644
index 0000000..8f59431
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ThreadPoolEvent.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.CamelEvent;
+
+public class ThreadPoolEvent implements CamelEvent.CamelContextEvent {
+ private final CamelContext camelContext;
+ private final ThreadPoolExecutor threadPool;
+
+ public ThreadPoolEvent(CamelContext camelContext, ThreadPoolExecutor
threadPool) {
+ this.camelContext = camelContext;
+ this.threadPool = threadPool;
+ }
+
+ @Override
+ public CamelContext getContext() {
+ return this.camelContext;
+ }
+
+ public ThreadPoolExecutor getThreadPool() {
+ return threadPool;
+ }
+
+ @Override
+ public Type getType() {
+ return Type.Custom;
+ }
+}
diff --git
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ThreadPoolRemoveEvent.java
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ThreadPoolRemoveEvent.java
new file mode 100644
index 0000000..372a546
--- /dev/null
+++
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/events/ThreadPoolRemoveEvent.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.events;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+import org.apache.camel.CamelContext;
+
+public class ThreadPoolRemoveEvent extends ThreadPoolEvent {
+ public ThreadPoolRemoveEvent(CamelContext camelContext, ThreadPoolExecutor
executor) {
+ super(camelContext, executor);
+ }
+}