squakez commented on code in PR #6922:
URL: https://github.com/apache/camel-k/pull/6922#discussion_r4431102754


##########
pkg/trait/keda/scalers/ibmmq.go:
##########
@@ -0,0 +1,107 @@
+/*
+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 scalers
+
+import (
+       "strings"
+
+       keda "github.com/apache/camel-k/v2/pkg/trait/keda"
+)
+
+const (
+       ibmmqScalerType       = "ibmmq"
+       ibmmqQueueTypeKey     = "queueType"

Review Comment:
   I think this one becomes redundant as it should be implicit by the usage of 
this scaler. If the user is marking this scaler, then, the queue type is always 
ibm queue.



##########
pkg/trait/keda/scalers/ibmmq.go:
##########
@@ -0,0 +1,107 @@
+/*
+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 scalers
+
+import (
+       "strings"
+
+       keda "github.com/apache/camel-k/v2/pkg/trait/keda"
+)
+
+const (
+       ibmmqScalerType       = "ibmmq"
+       ibmmqQueueTypeKey     = "queueType"
+       ibmmqQueueTypeValue   = "ibm"
+       ibmmqAdminHostKey     = "host"
+)
+
+// IBMMQScaler maps explicitly selected JMS queue endpoints to the KEDA IBM MQ 
scaler.
+type IBMMQScaler struct{}
+
+func init() {
+       keda.Register(&IBMMQScaler{})
+}
+
+func (i *IBMMQScaler) Component() string {
+       return "jms"
+}
+
+// Map intentionally declines discovery without autoMetadata. IBM MQ and other
+// JMS providers share the same Camel component, so the provider cannot be
+// inferred safely from the endpoint URI.
+func (i *IBMMQScaler) Map(pathValue string, params map[string]string, props 
map[string]string) (string, map[string]string) {
+       return "", nil
+}
+
+// MapWithAutoMetadata maps JMS queue consumers only when the Integration
+// explicitly opts in to IBM MQ and provides KEDA's required admin REST host.
+func (i *IBMMQScaler) MapWithAutoMetadata(pathValue string, params 
map[string]string, props map[string]string, autoMetadata 
map[string]map[string]string) (string, map[string]string) {
+       ibmmqMetadata, ok := autoMetadata[ibmmqScalerType]
+       if !ok || 
!strings.EqualFold(strings.TrimSpace(ibmmqMetadata[ibmmqQueueTypeKey]), 
ibmmqQueueTypeValue) {
+               return "", nil
+       }
+       if strings.TrimSpace(ibmmqMetadata[ibmmqAdminHostKey]) == "" {

Review Comment:
   Could it may be derived by looking at the properties?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to