BulePrism进阶教程-10. Additional Features

Blue Prism 进阶特性详解
本文档介绍了Blue Prism的一些高级特性,包括安全停止、集合操作、选择阶段、日志记录、日志查看器、系统管理器、流程/业务对象分组、引用查看、导入导出、发布管理器等,旨在帮助用户更深入地理解和使用Blue Prism。

This section deals with some of the aspects of Blue Prism we have not yet looked at.
10.1. Safe Stop
When a process is running in Control Room you can stop the process by selecting the process session and clicking Stop Selection. This will stop the process immediately. The case currently being worked will not be completed and Blue Prism will mark it as an Exception at Clean Up.
Figure 143: Control Room Session Controls
If you right click a running process session you will see the following stop options; Immediate Stop and Request Stop.
Figure 144: Context Menu for Running Processes
Immediate Stop is the equivalent of Stop Selection. Request Stop will ask the process to stop where there is a configured safe stop with the process.
You can configure a safe stop within your process by using the inbuilt Environment function IsStopRequested() within a Decision stage.

Typically you would place this Decision stage prior to getting the next case from a Work Queue. This will allow the process to complete the current case before detecting a safe stop request and processing accordingly.


Figure 146: Process Checking for a Safe Stop Request
10.2. Collection Actions
We have seen how to create a Collection and how to use a loop to access each row. The special Internal - Collections Business Object has other actions that we have not used yet, most of which are self-explanatory.
 Add Row.
 Remove Row.
 Count Rows.
 Count Columns.
 Remove All Rows.
 Copy Rows. Copy Rows is used to generate a new Collection from a subset from another Collection
Key Point
 The inputs of the Internal – Work Queues actions ask for the name of the collection, rather than the collection itself. The data type of the “Collection Name” input is Text, not Collection.
10.3. Choice Stage
Like the Decision stage, the choice stage is based on expressions that result in either True or False. The difference is that a choice stage can evaluate a series of expressions rather than just one.
The choice stage looks a little like a Wait stage and works in a similar way, where each expression creates a separate branch. Expressions are evaluated in top-down order, and the first one found to be True takes the flow down that branch. The bottom Otherwise branch is taken if none of the expressions are True, much like the timeout end of a Wait stage.
Figure 147: Choice Stage Toolbar Button
Figure 148: Choice Stage
Figure 149: Choice Stage Properties
10.4. Logging
Blue Prism can log the details of stages used in Processes and Business Objects. By default, stages used in Process Studio are logged and those in Object Studio are not. This can easily be changed by modifying the properties of a stage, selection of stages or all stages.
Nearly all stage properties windows have a combo box with the stage logging options; Enabled, Disabled and Errors Only. Errors only will log the stage only if an error is thrown when the stage runs


Alternatively, the menu commands Edit > Selected Stages > and Edit > All Stages can be used to modify the stage logging of more than one stage at a time.

Figure 151: Logging Menu
Page information stages are not logged and Data Items are only logged when their values are used as inputs and outputs.
Key Points
 The decision as to which stages are logged and which are not should not be overlooked.
 Logs are particularly useful during a test phase as a means to investigate bugs.
 However a live Process running all day can put a vast amount of logs into the database, the maintenance and back up of which should be considered.
 The security or legal implications of storing sensitive data are also something to think about.
10.5. Log Viewer
The Log Viewer is used to inspect the log of a session, either as it is running or after it has finished. This is especially handy for reviewing the workings of a progress and tracking down problems.
The Log Viewer has a search function enabling you to look through the (often numerous) rows of a log and the visibility of columns can be configured to suit.
Figure 15
2: Log Viewer
10.6. System Manager
As the name suggests, System Manager is where Blue Prism’s own settings are kept. Some of the tasks that can be performed are as follows:
 Create and maintain user accounts, roles, and permissions.
 Retire resources, Processes, and Business Objects.
 View Process or Business Object change history.
 Manage web services.
 Manage work queues.

10.7. Process/Business Object Grouping
Processes and Business Objects can be arranged into groups in order to simplify and tidy the lists used in the Blue Prism application. Groupings have no effect on the Processes or Objects themselves. They are moved to and from groups by using “drag and drop” in System Manager. You can create groups by right clicking on either Processes or Objects in the Studio tab.

Figure 154: Process Grouping
10.8. Process and Object References
You can view what Processes and Business Object are using a particular Process or Business Object by finding references. To find references of a select Process or Business Object in Studio and click the hamburger icon at the top right and select Find References

Figure 155: Use the hamburger menu to Find References
This will return a list of where the Process/Business Object is used

10.9. Export and Import
A Process or Business Object can be exported as an XML file, and similarly an exported file can be imported into Blue Prism. This can be useful for backing up and moving work between databases.
A wizard is provided to guide the user through each step of the procedure.

Figure 157: Import Wizard
Exercise 10.7.1 Exporting and Importing
 From the main Blue Prism application window, select File > Export from the main menu.
 Experiment with exporting a Process as an XML file.
 Switch to a different database, if you like. Alternatively, you may simply imagine that you have done so. Choose File > Import and locate an XML file.
 Tip: Processes and Business Object names must be unique.
10.10. Release Manager – Packages and Releases
The above XML import/export is useful for one-off ad hoc migrations of specific Business Objects and Processes, but in the real world a Process might have several dependencies. For example, a Process might employ a range other Processes, Business Objects, and Work Queues.
To migrate all of these parts individually would be an error-prone task requiring careful attention to detail and conscientious use of checklists. For this reason, Blue Prism provides the Release Manager which allows users to create checklists known as Packages.
At various stages during the development cycle, a Release can be exported using the checklist provided in the Package. Two different releases produced on two different occasions could contain different versions of the Processes/Business Objects/work queues, etc., but because they have come from the same Package (i.e., the same checklist) they will contain the same items.

Figure 158: The Blue Prism Release Manager
Exercise 10.8.1 Creating a Package
 Go to Release Manager and click New Package.
 Complete the wizard, choosing a combination of items to include in the package. For this exercise, it is not important what items you pick.

Figure 159: Create a Package Wizard
Exercise 10.8.2 Exporting a Release
Now that a Package has been created, we can create a Release. The Release will be a snapshot of the state of each of the items in the Package at a particular moment in time.
 Select the Package you just created and click New Release.
 Choose a name for the release and provide some release notes (e.g., “Development complete. Process now ready for UAT.”).
 Choose a location to save the file; the file extension will be .bprelease
The Release file contains the details of all the items in the package and could be used to import the items into another database. Typically this would mean a new environment, e.g., exporting a Release from the Development environment and importing into a UAT environment.
Key Points
 Blue Prism creates different environments by using separate databases. Typically this would be three databases - Development, Test, and Live.
 Moving work from one database to another is done by exporting and importing.
 An exported file can also be attached to email and used as a basic back up.

<think>我们根据引用内容分析用户问题:用户在使用`--spring.config.additional-location`参数时遇到配置不生效的问题。 引用[1]指出:`--spring.config.location`配置不生效,启动时不报错,但配置内容不生效。 引用[2]强调:当`spring.config.additional-location`指定为目录时,最后一定要加斜杠"/",否则报错。 引用[3]说明:`--spring.config.additional-location`后面接的必须是一个目录,不是一个文件,直接接配置文件会不生效。 引用[4]提到:在Docker中启动时,指定配置文件位置不生效,可能是路径问题。 因此,用户的问题可能是由于路径格式不正确(比如缺少斜杠)或者错误地指定了文件而不是目录。 解决方案: 1. 确保`--spring.config.additional-location`参数的值是一个目录(以斜杠结尾),而不是一个文件。 2. 如果确实需要指定一个文件,应该使用`--spring.config.location`参数(注意:这个参数会替换默认的配置文件位置,而不是追加)。 3. 检查路径是否正确,尤其是在容器环境中,需要确保挂载的卷和容器内路径一致。 具体步骤: 步骤1:检查路径格式 - 如果指定目录,确保以`/`结尾(对于Unix-like系统)或`\`(对于Windows,但注意在命令行中可能需要转义或使用正斜杠)。 - 示例:`file:/home/user/config/` (注意最后的斜杠) 步骤2:区分`additional-location`和`location` - `spring.config.additional-location`用于追加额外的配置位置,不会覆盖默认位置(如classpath:application.yml)。 - `spring.config.location`用于替换默认的配置位置,如果指定,则默认位置不再被加载。 步骤3:检查文件命名 - 放在指定目录下的配置文件必须命名为`application.properties`、`application.yml`或`application-{profile}.properties/yml`。 - 或者,如果使用非标准命名,则需要使用`spring.config.name`参数指定配置文件名(不带扩展名)。 步骤4:容器环境(如Docker)检查 - 确保挂载的配置文件在容器内的指定目录中存在。 - 检查文件权限,确保应用有读取权限。 步骤5:使用绝对路径 - 尽量使用绝对路径,避免相对路径带来的歧义。 步骤6:启用调试日志 - 启动时添加`--debug`参数,查看配置加载的详细日志。 示例: 错误示例(指定文件): --spring.config.additional-location=file:/config/nacos.yml # 可能不生效 正确示例(指定目录): --spring.config.additional-location=file:/config/ # 加载该目录下的application*.yml或nacos.yml(如果命名符合)? 注意:根据Spring Boot文档,在`additional-location`中指定的目录,Spring Boot会查找该目录下的`application`为前缀的配置文件。但是,如果我们想加载一个特定名称的配置文件(如nacos.yml),我们需要使用`spring.config.name`参数吗?实际上,`spring.config.name`默认是`application`,所以非`application`开头的文件不会被加载。 因此,如果我们要加载一个名为`nacos.yml`的配置文件,有两种方法: 方法1:使用`spring.config.location`指定具体的文件(注意这会替换默认配置): --spring.config.location=file:/config/nacos.yml 方法2:将`nacos.yml`放在`additional-location`指定的目录中,并且通过`spring.config.name`参数指定配置文件名(不带扩展名): --spring.config.additional-location=file:/config/ --spring.config.name=application,nacos # 注意:这里指定多个配置文件名(不带扩展名),Spring Boot会查找nacos.properties/yml等 但是,方法2中,`spring.config.name`的默认值是`application`,所以如果我们只指定了`additional-location`为目录,那么只会加载该目录下的`application`开头的配置文件。因此,如果我们想加载`nacos.yml`,必须同时设置`spring.config.name`为`nacos`,并且这样设置后,默认的`application`也会被加载(因为`spring.config.name`可以指定多个,用逗号分隔)。 然而,这种方法会导致两个问题: 1. 应用会同时加载`application`和`nacos`两个配置,如果两个配置中有相同的属性,则按顺序后加载的会覆盖先加载的。 2. 如果我们的意图是只加载`nacos.yml`,那么这种方法并不合适。 因此,更简单的方法可能是使用`spring.config.location`来指定具体的文件(注意这会替换默认的配置位置,所以如果还需要默认的`application`配置,则需要显式地加上): --spring.config.location=classpath:/,file:/config/nacos.yml 这样,Spring Boot会先加载classpath下的`application`配置,然后加载`file:/config/nacos.yml`。 总结用户问题:用户可能错误地将`spring.config.additional-location`指向了一个文件而不是目录,导致配置未加载。 解决方案: 1. 如果配置是一个目录,确保以`/`结尾。 2. 如果配置是一个特定的文件,使用`spring.config.location`参数,并同时包含默认配置位置(如果需要)和该文件。 示例(使用目录): --spring.config.additional-location=file:/conf/ # 目录下必须有application*.properties/yml文件 示例(使用特定文件,同时保留默认配置): --spring.config.location=classpath:/,classpath:/config/,file:/conf/nacos.yml 注意:在Spring Boot 2.4之后,配置文件的处理方式有所改变,支持多文档配置(一个文件里用`---`分隔多个profile)和显式导入(使用`spring.config.import`)。因此,也可以考虑使用`spring.config.import`来导入额外的配置文件,而不改变默认行为。 例如,在`application.yml`中: spring: config: import: optional:file:./nacos.yml 或者通过命令行: --spring.config.import=optional:file:./nacos.yml 这样,nacos.yml会被加载,而且不会影响默认的配置加载顺序。 因此,如果用户使用的是Spring Boot 2.4及以上版本,推荐使用`spring.config.import`来导入额外的配置文件。 综上所述,解决步骤: 1. 检查Spring Boot版本: - 如果版本>=2.4,建议使用`spring.config.import`导入配置文件。 - 如果版本<2.4,则使用`spring.config.location`或`spring.config.additional-location`,并注意路径格式。 2. 根据版本选择方案: - 方案A(Spring Boot>=2.4): 命令行:`--spring.config.import=optional:file:./nacos.yml` 或者写在`application.yml`中:`spring.config.import=optional:file:./nacos.yml` - 方案B(任何版本): 使用目录形式(确保目录以斜杠结尾)并将配置文件命名为`application.yml`或`application-{profile}.yml`,然后通过`--spring.config.additional-location=file:/path/to/dir/`加载。 - 方案C(任何版本): 使用`spring.config.location`指定具体文件,并保留默认配置位置(如果需要): `--spring.config.location=classpath:/,classpath:/config/,file:/path/to/nacos.yml` 3. 检查路径是否正确,尤其是在容器中,确保文件存在且路径正确。 4. 添加`--debug`参数查看配置加载日志,确认配置文件是否被加载。 5. 检查文件权限(Linux系统)。 6. 如果配置文件是动态生成或挂载的,确保在应用启动前文件已就绪。 相关问题: 1. 如何查看Spring Boot加载了哪些配置文件? 2. Spring Boot配置文件的加载顺序是什么? 3. 如何在Docker中正确挂载配置文件? 4. Spring Boot 2.4及以上版本中`spring.config.import`的使用方法?</think>### 解决 `spring.config.additional-location` 配置不生效的方法 #### 1. **检查路径格式(核心问题)** - **必须指定目录而非文件**,且目录需以斜杠结尾(根据引用[2][^2][^3]): ```bash # 正确(目录结尾有斜杠) --spring.config.additional-location=file:/home/conf/ # 错误(直接指定文件不生效) --spring.config.additional-location=file:/home/conf/nacos.yml ``` - **目录内配置文件命名规则**: - 需命名为 `application.properties` 或 `application.yml` - 或使用 `application-{profile}.yml` 格式(如 `application-prod.yml`) #### 2. **容器环境特殊处理(Docker/K8s)** - **确保卷挂载路径一致**(引用[4][^4]): ```bash docker run -v /host/config:/container/config \ --spring.config.additional-location=file:/container/config/ ``` - 验证:进入容器检查文件是否存在 `docker exec -it <容器ID> ls /container/config` #### 3. **路径协议声明** - 显式声明协议前缀(`file:` 或 `classpath:`): ```bash # 文件系统路径 --spring.config.additional-location=file:./external/ # 类路径资源 --spring.config.additional-location=classpath:/config/ ``` #### 4. **配置文件加载验证** - 启用调试模式查看加载详情: ```bash java -jar app.jar --debug --spring.config.additional-location=file:./conf/ ``` 在日志中搜索: ``` Config resource loaded: file:/home/conf/application.yml ``` #### 5. **多目录加载的正确格式** - 多个目录用逗号分隔,**每个目录以斜杠结尾**: ```bash --spring.config.additional-location=file:/conf/,file:/backup/ ``` #### 6. **Spring Boot 版本适配** - **Spring Boot 2.4+** 推荐使用新方案: ```yaml # application.yml 中配置 spring: config: import: optional:file:./nacos.yml # 直接加载特定文件 ``` #### 7. **常见错误排查表 | 现象 | 原因 | 解决方案 | |------|------|----------| | 配置无报错不生效 | 路径指向文件而非目录 | 改为目录路径并以`/`结尾 | | Docker中配置未加载 | 容器挂载路径错误 | 检查`-v`参数与容器内路径一致性 | | Windows路径失效 | 未转义反斜杠 | 使用`file:C:\\conf\\` 或 `file:/C:/conf/` | | 部分配置生效 | 文件名不符合规范 | 重命名为`application.yml` | > **关键提示**:通过 `--debug` 输出的 `ConfigFileApplicationListener` 日志是诊断加载问题的黄金标准。 #### 8. **备用方案:改用 `spring.config.location`** 若仍需加载特定文件名: ```bash # 同时保留默认配置(classpath)和外部文件 --spring.config.location=classpath:/,classpath:/config/,file:/home/nacos.yml ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值