You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by GitBox <gi...@apache.org> on 2022/04/04 04:20:38 UTC

[GitHub] [camel-k] tadayosi commented on a diff in pull request #3159: added trait example of services

tadayosi commented on code in PR #3159:
URL: https://github.com/apache/camel-k/pull/3159#discussion_r841355003


##########
examples/traits/service/service.java:
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+//kamel run --trait service.enabled=true
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.example.MyClass;
+
+public class Classpath extends RouteBuilder {
+  @Override
+  public void configure() throws Exception {
+	  from("timer:tick")
+        .log(MyClass.sayHello());

Review Comment:
   Where is `MyClass`?  You should make it run standalone.
   A rest route should be more straightforward for demonstrating the service trait usage, as it would expose some service to other pods:
   https://github.com/apache/camel-k/blob/main/examples/rest/RestDSL.java



##########
examples/traits/service/service.java:
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+//kamel run --trait service.enabled=true

Review Comment:
   Add file name to the command so it can run as is.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org