This is an automated email from the ASF dual-hosted git repository. riemer pushed a commit to branch remove-consul in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 1f61eefa603334ef09acc3904d6d4ebd10302348 Author: Dominik Riemer <[email protected]> AuthorDate: Sun Aug 6 15:45:46 2023 +0200 Add messaging layer settings to configuration section --- .../pe/jvm/config/AllPipelineElementsConfig.java | 69 ------- .../manager/setup/SpCoreConfigurationStep.java | 1 + .../manager/setup}/StreamPipesEnvChecker.java | 12 +- .../streampipes/rest/impl/admin/ConsulConfig.java | 198 --------------------- .../impl/admin/MessagingConfigurationResource.java | 60 +++++++ .../service/core/StreamPipesCoreApplication.java | 1 + .../service/core/StreamPipesResourceConfig.java | 4 +- .../streampipes/svcdiscovery/SpConfigCore.java | 121 ------------- ui/src/app/configuration/configuration.module.ts | 2 + .../broker-config/broker-config.component.html | 35 ++++ .../broker-config/broker-config.component.ts | 20 ++- .../messaging-configuration.component.html | 53 ++++++ .../messaging-configuration.component.ts | 2 +- .../configuration/shared/configuration.service.ts | 18 +- 14 files changed, 185 insertions(+), 411 deletions(-) diff --git a/streampipes-extensions/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/config/AllPipelineElementsConfig.java b/streampipes-extensions/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/config/AllPipelineElementsConfig.java deleted file mode 100644 index ff7b41160..000000000 --- a/streampipes-extensions/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/config/AllPipelineElementsConfig.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.streampipes.pe.jvm.config; - -import org.apache.streampipes.extensions.api.PeConfig; -import org.apache.streampipes.svcdiscovery.SpServiceDiscovery; -import org.apache.streampipes.svcdiscovery.api.SpConfig; - -public enum AllPipelineElementsConfig implements PeConfig { - INSTANCE; - - private SpConfig config; - - public static String serverUrl; - - private static final String service_id = "pe/org.apache.streampipes.processors.all.jvm"; - private static final String service_name = "Processors JVM (Bundle)"; - private static final String service_container_name = "pipeline-elements-all-jvm"; - - AllPipelineElementsConfig() { - config = SpServiceDiscovery.getSpConfig(service_id); - config.register(ConfigKeys.HOST, service_container_name, "Hostname for the pe esper"); - config.register(ConfigKeys.PORT, 8090, "Port for the pe esper"); - - config.register(ConfigKeys.SERVICE_NAME_KEY, service_name, "The name of the service"); - - } - - static { - serverUrl = - AllPipelineElementsConfig.INSTANCE.getHost() + ":" + AllPipelineElementsConfig.INSTANCE.getPort(); - } - - @Override - public String getHost() { - return config.getString(ConfigKeys.HOST); - } - - @Override - public int getPort() { - return config.getInteger(ConfigKeys.PORT); - } - - @Override - public String getId() { - return service_id; - } - - @Override - public String getName() { - return config.getString(ConfigKeys.SERVICE_NAME_KEY); - } - -} diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/SpCoreConfigurationStep.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/SpCoreConfigurationStep.java index 25bbc996b..187d677ef 100644 --- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/SpCoreConfigurationStep.java +++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/SpCoreConfigurationStep.java @@ -27,6 +27,7 @@ public class SpCoreConfigurationStep extends InstallationStep { var coreCfg = new DefaultSpCoreConfiguration().make(); StorageDispatcher.INSTANCE.getNoSqlStore().getSpCoreConfigurationStorage().createElement(coreCfg); + new StreamPipesEnvChecker().updateEnvironmentVariables(); } @Override diff --git a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesEnvChecker.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/StreamPipesEnvChecker.java similarity index 93% rename from streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesEnvChecker.java rename to streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/StreamPipesEnvChecker.java index f200276a5..17dc5072e 100644 --- a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesEnvChecker.java +++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/StreamPipesEnvChecker.java @@ -16,7 +16,7 @@ * */ -package org.apache.streampipes.service.core; +package org.apache.streampipes.manager.setup; import org.apache.streampipes.commons.environment.Environment; import org.apache.streampipes.commons.environment.Environments; @@ -40,7 +40,7 @@ public class StreamPipesEnvChecker { private ISpCoreConfigurationStorage configStorage; private SpCoreConfiguration coreConfig; - private Environment env; + private final Environment env; public StreamPipesEnvChecker() { this.env = Environments.getEnvironment(); @@ -52,10 +52,12 @@ public class StreamPipesEnvChecker { .getNoSqlStore() .getSpCoreConfigurationStorage(); - this.coreConfig = configStorage.get(); + if (configStorage.getAll().size() > 0) { + this.coreConfig = configStorage.get(); - LOG.info("Checking and updating environment variables..."); - updateJwtSettings(); + LOG.info("Checking and updating environment variables..."); + updateJwtSettings(); + } } private void updateJwtSettings() { diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ConsulConfig.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ConsulConfig.java deleted file mode 100644 index 7b85057f6..000000000 --- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ConsulConfig.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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.streampipes.rest.impl.admin; - - -import org.apache.streampipes.model.configuration.MessagingSettings; -import org.apache.streampipes.model.extensions.configuration.ConfigItem; -import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource; -import org.apache.streampipes.rest.security.AuthConstants; -import org.apache.streampipes.rest.shared.annotation.JacksonSerialized; -import org.apache.streampipes.svcdiscovery.api.ISpKvManagement; -import org.apache.streampipes.svcdiscovery.api.model.PeConfig; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.stereotype.Component; - -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -@Path("/v2/consul") -@Component -public class ConsulConfig extends AbstractAuthGuardedRestResource { - - private static final Logger LOG = LoggerFactory.getLogger(ConsulConfig.class); - - @GET - @Produces(MediaType.APPLICATION_JSON) - @JacksonSerialized - @PreAuthorize(AuthConstants.IS_ADMIN_ROLE) - public Response getAllServiceConfigs() { - LOG.info("Request for all service configs"); - Map<String, String> peServices = getServiceDiscovery().getExtensionsServiceGroups(); - - List<PeConfig> peConfigs = new LinkedList<>(); - - for (Map.Entry<String, String> entry : peServices.entrySet()) { - String serviceStatus = entry.getValue(); - String mainKey = entry.getKey(); - - Map<String, String> meta = new HashMap<>(); - meta.put("status", serviceStatus); - List<ConfigItem> configItems = getConfigForService(entry.getKey()); - - PeConfig peConfig = new PeConfig(); - - for (ConfigItem configItem : configItems) { - if (configItem.getKey().endsWith("SP_SERVICE_NAME")) { - configItems.remove(configItem); - peConfig.setName(configItem.getValue()); - break; - } - } - - peConfig.setMeta(meta); - peConfig.setMainKey(mainKey); - peConfig.setConfigs(configItems); - - peConfigs.add(peConfig); - } - - return ok(peConfigs); - } - - @POST - @Produces(MediaType.APPLICATION_JSON) - @JacksonSerialized - @PreAuthorize(AuthConstants.IS_ADMIN_ROLE) - public Response saveServiceConfig(PeConfig peConfig) { - - ISpKvManagement keyValueStore = getKeyValueStore(); - LOG.info("Request to update a service config"); - for (ConfigItem configItem : peConfig.getConfigs()) { - String value = configItem.getValue(); - switch (configItem.getValueType()) { - case "xs:boolean": - if (!("true".equals(value) || "false".equals(value))) { - LOG.error(value + " is not from the type: xs:boolean"); - return Response.status(Response.Status.BAD_REQUEST) - .entity(value + " is not from the type: xs:boolean").build(); - } - break; - case "xs:integer": - try { - Integer.valueOf(value); - } catch (java.lang.NumberFormatException e) { - LOG.error(value + " is not from the type: xs:integer"); - return Response.status(Response.Status.BAD_REQUEST) - .entity(value + " is not from the type: xs:integer").build(); - } - break; - case "xs:double": - try { - Double.valueOf(value); - } catch (java.lang.NumberFormatException e) { - LOG.error(value + " is not from the type: xs:double"); - return Response.status(Response.Status.BAD_REQUEST) - .entity(value + " is not from the type: xs:double").build(); - } - break; - case "xs:string": - break; - default: - LOG.error(configItem.getValueType() + " is not a supported type"); - return Response.status(Response.Status.BAD_REQUEST) - .entity(configItem.getValueType() + " is not a supported type").build(); - } - } - - String prefix = peConfig.getMainKey(); - - for (ConfigItem configItem : peConfig.getConfigs()) { - JsonObject jsonObj = new Gson().toJsonTree(configItem).getAsJsonObject(); - jsonObj.entrySet().removeIf(e -> e.getKey().equals("key")); - keyValueStore.updateConfig(configItem.getKey(), jsonObj.toString(), - configItem.isPassword()); - } - return Response.status(Response.Status.OK).build(); - } - - @DELETE - @Produces(MediaType.APPLICATION_JSON) - @JacksonSerialized - @PreAuthorize(AuthConstants.IS_ADMIN_ROLE) - public Response deleteService(String serviceName) { - LOG.info("Request to delete a service config"); - getServiceDiscovery().deregisterService(serviceName); - return Response.status(Response.Status.OK).build(); - } - - @GET - @Produces(MediaType.APPLICATION_JSON) - @JacksonSerialized - @Path("/messaging") - @PreAuthorize(AuthConstants.IS_ADMIN_ROLE) - public Response getMessagingSettings() { - return ok(getSpCoreConfigurationStorage().get().getMessagingSettings()); - } - - @POST - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - @JacksonSerialized - @Path("messaging") - @PreAuthorize(AuthConstants.IS_ADMIN_ROLE) - public Response updateMessagingSettings(MessagingSettings messagingSettings) { - var cfg = getSpCoreConfigurationStorage().get(); - cfg.setMessagingSettings(messagingSettings); - getSpCoreConfigurationStorage().updateElement(cfg); - return ok(); - } - - public List<ConfigItem> getConfigForService(String serviceId) { - Map<String, String> keyValues = getKeyValueStore().getKeyValue(serviceId); - - List<ConfigItem> configItems = new LinkedList<>(); - - for (Map.Entry<String, String> entry : keyValues.entrySet()) { - ConfigItem configItem = new Gson().fromJson(entry.getValue(), ConfigItem.class); - configItem.setKey(entry.getKey()); - - configItems.add(configItem); - } - return configItems; - } - - -} diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/MessagingConfigurationResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/MessagingConfigurationResource.java new file mode 100644 index 000000000..ed421d5cd --- /dev/null +++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/MessagingConfigurationResource.java @@ -0,0 +1,60 @@ +/* + * 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.streampipes.rest.impl.admin; + +import org.apache.streampipes.model.configuration.MessagingSettings; +import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource; +import org.apache.streampipes.rest.security.AuthConstants; +import org.apache.streampipes.rest.shared.annotation.JacksonSerialized; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Component; + +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +@Path("/v2/messaging") +@Component +public class MessagingConfigurationResource extends AbstractAuthGuardedRestResource { + + @GET + @Produces(MediaType.APPLICATION_JSON) + @JacksonSerialized + @PreAuthorize(AuthConstants.IS_ADMIN_ROLE) + public Response getMessagingSettings() { + return ok(getSpCoreConfigurationStorage().get().getMessagingSettings()); + } + + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + @JacksonSerialized + @PreAuthorize(AuthConstants.IS_ADMIN_ROLE) + public Response updateMessagingSettings(MessagingSettings messagingSettings) { + var cfg = getSpCoreConfigurationStorage().get(); + cfg.setMessagingSettings(messagingSettings); + getSpCoreConfigurationStorage().updateElement(cfg); + return ok(); + } +} diff --git a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java index 226b9f2d1..23f766369 100644 --- a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java +++ b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java @@ -23,6 +23,7 @@ import org.apache.streampipes.manager.health.ServiceHealthCheck; import org.apache.streampipes.manager.monitoring.pipeline.ExtensionsServiceLogExecutor; import org.apache.streampipes.manager.operations.Operations; import org.apache.streampipes.manager.setup.AutoInstallation; +import org.apache.streampipes.manager.setup.StreamPipesEnvChecker; import org.apache.streampipes.messaging.SpProtocolManager; import org.apache.streampipes.messaging.jms.SpJmsProtocolFactory; import org.apache.streampipes.messaging.kafka.SpKafkaProtocolFactory; diff --git a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesResourceConfig.java b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesResourceConfig.java index 63da27b65..49c29bdd1 100644 --- a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesResourceConfig.java +++ b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesResourceConfig.java @@ -56,12 +56,12 @@ import org.apache.streampipes.rest.impl.RestorePasswordResource; import org.apache.streampipes.rest.impl.Setup; import org.apache.streampipes.rest.impl.UserResource; import org.apache.streampipes.rest.impl.Version; -import org.apache.streampipes.rest.impl.admin.ConsulConfig; import org.apache.streampipes.rest.impl.admin.DataExportResource; import org.apache.streampipes.rest.impl.admin.DataImportResource; import org.apache.streampipes.rest.impl.admin.EmailConfigurationResource; import org.apache.streampipes.rest.impl.admin.ExtensionsServiceEndpointResource; import org.apache.streampipes.rest.impl.admin.GeneralConfigurationResource; +import org.apache.streampipes.rest.impl.admin.MessagingConfigurationResource; import org.apache.streampipes.rest.impl.admin.PermissionResource; import org.apache.streampipes.rest.impl.admin.PipelineElementImport; import org.apache.streampipes.rest.impl.admin.ServiceConfigurationResource; @@ -111,7 +111,6 @@ public class StreamPipesResourceConfig extends BaseResourceConfig { AssetManagementResource.class, AutoComplete.class, CategoryResource.class, - ConsulConfig.class, ContainerProvidedOptions.class, DashboardWidget.class, Dashboard.class, @@ -131,6 +130,7 @@ public class StreamPipesResourceConfig extends BaseResourceConfig { GenericStorageResource.class, LabelResource.class, MeasurementUnitResource.class, + MessagingConfigurationResource.class, Notification.class, OntologyMeasurementUnit.class, PermissionResource.class, diff --git a/streampipes-service-discovery/src/main/java/org/apache/streampipes/svcdiscovery/SpConfigCore.java b/streampipes-service-discovery/src/main/java/org/apache/streampipes/svcdiscovery/SpConfigCore.java deleted file mode 100644 index de3685c3f..000000000 --- a/streampipes-service-discovery/src/main/java/org/apache/streampipes/svcdiscovery/SpConfigCore.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.streampipes.svcdiscovery; - -import org.apache.streampipes.model.extensions.configuration.ConfigItem; -import org.apache.streampipes.model.extensions.configuration.ConfigurationScope; -import org.apache.streampipes.svcdiscovery.api.SpConfig; - -public class SpConfigCore implements SpConfig { - - @Override - public <T> void register(String key, T defaultValue, String description, ConfigurationScope configurationScope) { - - } - - @Override - public void register(String key, boolean defaultValue, String description) { - - } - - @Override - public void register(String key, int defaultValue, String description) { - - } - - @Override - public void register(String key, double defaultValue, String description) { - - } - - @Override - public void register(String key, String defaultValue, String description) { - - } - - @Override - public void register(ConfigItem configItem) { - - } - - @Override - public void registerObject(String key, Object defaultValue, String description) { - - } - - @Override - public void registerPassword(String key, String defaultValue, String description) { - - } - - @Override - public boolean getBoolean(String key) { - return false; - } - - @Override - public int getInteger(String key) { - return 0; - } - - @Override - public double getDouble(String key) { - return 0; - } - - @Override - public String getString(String key) { - return null; - } - - @Override - public <T> T getObject(String key, Class<T> clazz, T defaultValue) { - return null; - } - - @Override - public ConfigItem getConfigItem(String key) { - return null; - } - - @Override - public void setBoolean(String key, Boolean value) { - - } - - @Override - public void setInteger(String key, int value) { - - } - - @Override - public void setDouble(String key, double value) { - - } - - @Override - public void setString(String key, String value) { - - } - - @Override - public void setObject(String key, Object value) { - - } -} diff --git a/ui/src/app/configuration/configuration.module.ts b/ui/src/app/configuration/configuration.module.ts index fbea2a2e3..db24cb548 100644 --- a/ui/src/app/configuration/configuration.module.ts +++ b/ui/src/app/configuration/configuration.module.ts @@ -63,6 +63,7 @@ import { ServiceConfigsBooleanComponent } from './extensions-service-management/ import { ServiceConfigsNumberComponent } from './extensions-service-management/extensions-service-configuration/service-configs/service-configs-number/service-configs-number.component'; import { SpRegisteredExtensionsServiceComponent } from './extensions-service-management/registrered-extensions-services/registered-extensions-services.component'; import { SpExtensionsServiceConfigurationComponent } from './extensions-service-management/extensions-service-configuration/extensions-service-configuration.component'; +import { SpMessagingBrokerConfigComponent } from './messaging-configuration/broker-config/broker-config.component'; @NgModule({ imports: [ @@ -154,6 +155,7 @@ import { SpExtensionsServiceConfigurationComponent } from './extensions-service- SpDataImportDialogComponent, SpEditLabelComponent, SpLabelConfigurationComponent, + SpMessagingBrokerConfigComponent, SpRegisteredExtensionsServiceComponent, SpExtensionsServiceConfigurationComponent, ], diff --git a/ui/src/app/configuration/messaging-configuration/broker-config/broker-config.component.html b/ui/src/app/configuration/messaging-configuration/broker-config/broker-config.component.html new file mode 100644 index 000000000..d97c4bd56 --- /dev/null +++ b/ui/src/app/configuration/messaging-configuration/broker-config/broker-config.component.html @@ -0,0 +1,35 @@ +<!-- + ~ 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. + ~ + --> + +<div fxFlex="100" fxLayout="column"> + <div class="subsection-title">{{ title }}</div> + <div fxLayout="row" fxLayoutGap="15px"> + <div> + <mat-form-field class="form-field" fxFlex="100" color="accent"> + <mat-label>Host</mat-label> + <input matInput [(ngModel)]="host" type="text" /> + </mat-form-field> + </div> + <div> + <mat-form-field class="form-field" fxFlex="100" color="accent"> + <mat-label>Port</mat-label> + <input matInput [(ngModel)]="port" type="number" /> + </mat-form-field> + </div> + </div> +</div> diff --git a/streampipes-extensions/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/config/ConfigKeys.java b/ui/src/app/configuration/messaging-configuration/broker-config/broker-config.component.ts similarity index 72% rename from streampipes-extensions/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/config/ConfigKeys.java rename to ui/src/app/configuration/messaging-configuration/broker-config/broker-config.component.ts index 77412c1b7..9a00398bb 100644 --- a/streampipes-extensions/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/config/ConfigKeys.java +++ b/ui/src/app/configuration/messaging-configuration/broker-config/broker-config.component.ts @@ -15,10 +15,20 @@ * limitations under the License. * */ -package org.apache.streampipes.pe.jvm.config; -public class ConfigKeys { - static final String HOST = "SP_HOST"; - static final String PORT = "SP_PORT"; - static final String SERVICE_NAME_KEY = "SP_SERVICE_NAME"; +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'sp-messaging-broker-config', + templateUrl: './broker-config.component.html', +}) +export class SpMessagingBrokerConfigComponent { + @Input() + title: string; + + @Input() + host: string; + + @Input() + port: number; } diff --git a/ui/src/app/configuration/messaging-configuration/messaging-configuration.component.html b/ui/src/app/configuration/messaging-configuration/messaging-configuration.component.html index 7afdeffa6..8f96bc886 100644 --- a/ui/src/app/configuration/messaging-configuration/messaging-configuration.component.html +++ b/ui/src/app/configuration/messaging-configuration/messaging-configuration.component.html @@ -167,5 +167,58 @@ </div> </div> </sp-split-section> + <mat-divider></mat-divider> + <sp-split-section + title="Messaging layers" + subtitle="Manage messaging layer connectivity" + > + <sp-messaging-broker-config + title="JMS" + [host]="messagingSettings.jmsHost" + [port]="messagingSettings.jmsPort" + ></sp-messaging-broker-config> + <sp-messaging-broker-config + title="Kafka" + [host]="messagingSettings.kafkaHost" + [port]="messagingSettings.kafkaPort" + ></sp-messaging-broker-config> + <sp-messaging-broker-config + title="MQTT" + [host]="messagingSettings.mqttHost" + [port]="messagingSettings.mqttPort" + ></sp-messaging-broker-config> + <sp-messaging-broker-config + title="Nats" + [host]="messagingSettings.natsHost" + [port]="messagingSettings.natsPort" + ></sp-messaging-broker-config> + <div fxLayout="column"> + <div class="subsection-title">Pulsar</div> + <mat-form-field class="form-field" fxFlex="100" color="accent"> + <mat-label>URL</mat-label> + <input + matInput + [(ngModel)]="messagingSettings.pulsarUrl" + type="text" + /> + </mat-form-field> + </div> + <sp-messaging-broker-config + title="Zookeeper" + [host]="messagingSettings.zookeeperHost" + [port]="messagingSettings.zookeeperPort" + ></sp-messaging-broker-config> + <div fxLayoutAlign="start center" class="mt-10"> + <button + mat-raised-button + color="accent" + type="submit" + class="md-raised md-primary submit-button" + (click)="updateMessagingSettings()" + > + Update + </button> + </div> + </sp-split-section> </div> </sp-basic-nav-tabs> diff --git a/ui/src/app/configuration/messaging-configuration/messaging-configuration.component.ts b/ui/src/app/configuration/messaging-configuration/messaging-configuration.component.ts index bc0e927c5..ec9c7d67a 100644 --- a/ui/src/app/configuration/messaging-configuration/messaging-configuration.component.ts +++ b/ui/src/app/configuration/messaging-configuration/messaging-configuration.component.ts @@ -18,11 +18,11 @@ import { Component, OnInit } from '@angular/core'; import { ConfigurationService } from '../shared/configuration.service'; -import { MessagingSettings } from '../shared/messaging-settings.model'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { SpConfigurationTabs } from '../configuration-tabs'; import { SpBreadcrumbService } from '@streampipes/shared-ui'; import { SpConfigurationRoutes } from '../configuration.routes'; +import { MessagingSettings } from '@streampipes/platform-services'; @Component({ selector: 'sp-messaging-configuration', diff --git a/ui/src/app/configuration/shared/configuration.service.ts b/ui/src/app/configuration/shared/configuration.service.ts index e23c8ce32..2e71d8037 100644 --- a/ui/src/app/configuration/shared/configuration.service.ts +++ b/ui/src/app/configuration/shared/configuration.service.ts @@ -20,12 +20,12 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { MessagingSettings } from './messaging-settings.model'; import { MultipartUtils } from './multipart-utils'; import { + MessagingSettings, SpServiceConfiguration, SpServiceRegistration, -} from '../../../../projects/streampipes/platform-services/src/lib/model/gen/streampipes-model'; +} from '@streampipes/platform-services'; @Injectable() export class ConfigurationService { @@ -51,13 +51,11 @@ export class ConfigurationService { } getMessagingSettings(): Observable<MessagingSettings> { - return this.http - .get(this.getServerUrl() + '/api/v2/consul/messaging') - .pipe( - map(response => { - return response as MessagingSettings; - }), - ); + return this.http.get(this.getServerUrl() + '/api/v2/messaging').pipe( + map(response => { + return response as MessagingSettings; + }), + ); } getRegisteredExtensionsServices(): Observable<SpServiceRegistration[]> { @@ -97,7 +95,7 @@ export class ConfigurationService { messagingSettings: MessagingSettings, ): Observable<Object> { return this.http.post( - this.getServerUrl() + '/api/v2/consul/messaging', + this.getServerUrl() + '/api/v2/messaging', messagingSettings, ); }
