简体   繁体   中英

How to set timeout in camunda in Spring Boot?

I want to set a timeout for 120 minutes in the session of Camunda. This is the configuration in my pom.xml:

...
...
<dependency>
            <groupId>org.camunda.bpm.springboot</groupId>
            <artifactId>camunda-bpm-spring-boot-starter</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.camunda.bpm.springboot</groupId>
            <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.camunda.bpm.springboot</groupId>
            <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.camunda.bpm</groupId>
            <artifactId>camunda-engine-rest-core</artifactId>
            <version>7.8.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
...
...

I tried a lot of tracks, two of which are the most proposed on the forums, one to use if spring boot version is < 1 and the other if spring boot is > 2:

server.connection-timeout=...
server.servlet.session.timeout=...

For the version of dependecies:

<springboot.version>2.3.0</springboot.version>
<version.camunda>7.8.0</version.camunda>

Are there other possibilities to set the timeout session?

I achieved something similar using spring session, when using spring boot 2.xx

My pom.xml has these dependencies:

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.session</groupId>
      <artifactId>spring-session-jdbc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.session</groupId>
      <artifactId>spring-session-core</artifactId>
    </dependency>

Using these, Camunda will rely on spring session for session management so you can control session using standard options provided by spring session. However, keep in mind this will use you persistence layer (postgres/h2/etc).

There's a spring.session.timeout available, try setting that one to 120m in application.properties / application.yaml .

I have these in my application.yaml config file

spring:
  session:
    store-type: jdbc
    jdbc.initialize-schema: always

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM