Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 14:32
    filip-majernik commented #627
  • Jan 31 2019 14:30
    filip-majernik commented #627
  • Jan 31 2019 12:51
    jvalkeal commented #627
  • Jan 31 2019 00:29
  • Jan 29 2019 22:38
  • Jan 29 2019 15:04
  • Jan 29 2019 14:10

    spring-buildmaster on v2.1.0.RC1

    (compare)

  • Jan 29 2019 14:10

    spring-buildmaster on 2.1.0.RC1

    Release version 2.1.0.RC1 (compare)

  • Jan 29 2019 14:04

    jvalkeal on master

    Update changelog (compare)

  • Jan 26 2019 17:44
  • Jan 26 2019 14:37
    jvalkeal commented #628
  • Jan 26 2019 14:36
    jvalkeal closed #628
  • Jan 26 2019 14:36

    jvalkeal on master

    Make equals work in DefaultStat… (compare)

  • Jan 26 2019 14:31
    jvalkeal milestoned #628
  • Jan 25 2019 16:36
    don-vip commented #626
  • Jan 25 2019 16:36
    don-vip closed #626
  • Jan 25 2019 14:51
    jvalkeal closed #625
  • Jan 25 2019 14:51

    jvalkeal on master

    Upgrade to kryo 4.0.2 - Fixes … (compare)

  • Jan 25 2019 14:49
    jvalkeal milestoned #625
  • Jan 25 2019 14:49
    jvalkeal commented #625
Gabriel Popovici
@popovici.gabriel_gitlab
can you cause transition inside an Action ?
say you are implementing an action and you decide to cause a transition like context.getStateMachine().send...
i am noticing this is returning false
do I always need to cause transitions outside of the Actions/Guards/etc ?
much appreciated
Gabriel Popovici
@popovici.gabriel_gitlab
wondering if I have to enable something extra on an application build with SSM; I am using JpaPersistingStateMachineInterceptor with H2 ; i am only seeing the table STATE_MACHINE gettting updated with information; why the others table are not filled in as expected ; do i need to to add something ; much appreciated
image.png
nicoulaj
@nicoulaj
Hi guys, I was wondering if SSM is scalable to several thousands of (simple) state machines in parallel ?
Veera93
@Veera93

Hi All,

I am new to state machines.. I was wondering if state machine supports the following..

  1. Get all previous states/events
  2. Get all possible states/events from current state

hi folks; i am evaluating State Machine by looking & running/debuging available samples; i took sample "datapersist" to understand how the "state saving" works under the hood; and I have a question regarding state machine; i am puzzled on where can i see previously stored states? i am only seeing current state but previous states are not in DB at all ?

@popovici.gabriel_gitlab did you get answer for this?

Barış Özaydın
@ozaydinb
Hi All,
We are to decide using spring state machine. We are designing chatbot application with SM and we have too many transition. For Example: we have s1, s2, s3 and s4 states. Our transitions are s1 to s2, s1 to s3 and s3 to s4 but also s2 to s3 and s4, s3 to s2 and s4, s4 to s2 and s4. I can configure transitions for that but when transision count increase configuration became too complex. Is there any basic way can allow any transision to any transition?
Doğukan Kündüm
@DogukanKundum

hi everybody,

i using spring state machine my project. this project has persist and distributed state machine. first state machine successfully all lifecycle begin to end. however, when second state machine start, loading before state machine configuration parameters. second state machine started null id and false states. what do i using distributed state machine ? please help!!!

Tuğberk Çelik
@tugberkkcelik_twitter
please help @DogukanKundum, important for us using distrubuted state machine concepts.
Doğukan Kündüm
@DogukanKundum

I using to work Distributed State Machine and state machine jpa.

java.lang.ClassCastException: org.springframework.statemachine.ensemble.DistributedStateMachine cannot be cast to org.springframework.statemachine.support.AbstractStateMachine
at org.springframework.statemachine.persist.AbstractStateMachinePersister.buildStateMachineContext(AbstractStateMachinePersister.java:107) ~[spring-statemachine-core-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.statemachine.persist.AbstractStateMachinePersister.persist(AbstractStateMachinePersister.java:65) ~[spring-statemachine-core-2.1.3.RELEASE.jar:2.1.3.RELEASE]

            StateMachinePersister<SubscriberStates, SubscriberEvents, String> persister = new DefaultStateMachinePersister(persist);
            stateMachine = stateMachineFactory.getStateMachine(id);
            stateMachine.start();
            persister.persist(stateMachine, id);
            return persister.restore(stateMachine, id); 
Does anyone have this problem ?
Doğukan Kündüm
@DogukanKundum
@ghahramani @jvalkeal pls help me?
Helen
@helenbelen
@jvalkeal Hello, I was wondering which approach is preferred for multiple state machine flows: Using multiple StateMachineFactory instances ( and referencing them via Application context) or using Builder Pattern? Any insights? We are struggling on our team to pick the approach which is most supported/recommended by the framework. Thank you!
haiderali22
@haiderali22
Hi hope all are fine, after adding spring-statemachine-data-jpa dependency for persisting state it thorws Caused by: java.lang.IllegalArgumentException:Not a managed type on Class declared as entity
Prabhat Ranjan
@prabhatcraz

Hi, I am quite new to state machine and trying to build a state machine using JPAConfig. I have below code:

@Log
@Configuration
@EnableStateMachineFactory
public class StateMachineConfig extends StateMachineConfigurerAdapter<String, String> {
    @Autowired
    private StateRepository<JpaRepositoryState> stateRepository;

    @Autowired
    private TransitionRepository<JpaRepositoryTransition> transitionRepository;

    @Override
    public void configure(StateMachineModelConfigurer<String, String> model) throws Exception {
        model
                .withModel()
                .factory(modelFactory());
    }

    @Bean
    public StateMachineModelFactory<String, String> modelFactory() {
        RepositoryStateMachineModelFactory repositoryStateMachineModelFactory = new RepositoryStateMachineModelFactory(stateRepository, transitionRepository);

        return repositoryStateMachineModelFactory;
    }
}

And I build the machine in a controller.

@RestController
@AllArgsConstructor
public class WorkFlowController {
    private final StateMachineFactory<String, String> stateMachineFactory;

    @PostMapping("/wf/event")
    public String sendEvent(@RequestBody SendEventInput eventInput) {

        final StateMachine<String, String> machine = stateMachineFactory.getStateMachine();
        machine.start();
        machine.sendEvent(eventInput.getEvent());

        return machine.getState().toString();
    }
}

But this gives me - org.springframework.statemachine.config.model.MalformedConfigurationException: Must have at least one transition

I have setup an H2 DB with following sql

INSERT INTO STATE
    (ID, INITIAL_STATE, KIND,STATE)
VALUES
(1, 1, 0, 'DOC_PENDING'),
(2, 0, 8, 'BANK_DETAILS'),
(3, 0, 8, 'DOC_PENDING'),
(4, 0, 1, 'CLOSED')
;

INSERT INTO TRANSITION
    (ID, EVENT, KIND, SOURCE_ID, TARGET_ID)
VALUES
    (1, 'DOC_SUBMITTED',     0, 1, 2),
    (2, 'ACCOUNT_SUBMITTED', 0, 2, 3),
    (3, 'DOC_REVIEWED',      0, 3, 4)
;

What am I missing?

Nikolaob96
@Nikolaob96
Hi! Can anyone help how can i execute state action A multiple times (each X seconds) if my entity is in some S state?
musaddique91
@musaddique91
Hi
i need a help.
I have create statemachine. I sent all events. so machine started from start and it is working. nowi want to kill the execution of state machine
Alexander Bogatyrenko
@alexander00513
Hi, can you please explain me about this exception -
org.springframework.statemachine.StateMachineException: Unable to persist stateMachineContext; nested exception is org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before calling save(): org.springframework.statemachine.data.jpa.JpaRepositoryStateMachine; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): org.springframework.statemachine.data.jpa.JpaRepositoryStateMachine
I have a simple JPA configuration
config.withPersistence()
.runtimePersister(stateMachineRuntimePersister);
config.withConfiguration()
.autoStartup(true)
.listener(new LeadStateMachineListener());
patpatpat123
@patpatpat123

Hello, hope you had a good weekend.

I was wondering, any spring-statemachine + spring WebFlux user here?
I am facing a problem where statemachine is blocking on a WebFlux project. was wondering how to work around that in a WebFlux project. Thank you!

2020-07-27 06:26:25.403 ERROR 14756 --- [ parallel-2] a.w.r.e.AbstractErrorWebExceptionHandler : [2b9817be] 500 Server Error for HTTP POST "/handler"

reactor.blockhound.BlockingOperationError: Blocking call! java.io.FileInputStream#readBytes
at java.io.FileInputStream.readBytes(FileInputStream.java) ~[?:?]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
| checkpoint ⇢ Handler someController#xxx(Mono) [DispatcherHandler]
|
checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ HTTP POST "/handler" [ExceptionHandlingWebHandler]
Stack trace:
at java.io.FileInputStream.readBytes(FileInputStream.java) ~[?:?]
at java.io.FileInputStream.read(FileInputStream.java:279) ~[?:?]
at java.io.FilterInputStream.read(FilterInputStream.java:133) ~[?:?]
at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424) ~[?:?]
at sun.security.provider.NativePRNG$RandomIO.ensureBufferValid(NativePRNG.java:526) ~[?:?]
at sun.security.provider.NativePRNG$RandomIO.implNextBytes(NativePRNG.java:545) ~[?:?]
at sun.security.provider.NativePRNG.engineNextBytes(NativePRNG.java:220) ~[?:?]
at java.security.SecureRandom.nextBytes(SecureRandom.java:741) ~[?:?]
at java.util.UUID.randomUUID(UUID.java:150) ~[?:?]
at org.springframework.statemachine.support.AbstractStateMachine.(AbstractStateMachine.java:168) ~[spring-statemachine-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at org.springframework.statemachine.ObjectStateMachine.(ObjectStateMachine.java:63) ~[spring-statemachine-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at org.springframework.statemachine.config.ObjectStateMachineFactory.buildStateMachineInternal(ObjectStateMachineFactory.java:75) ~[spring-statemachine-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at org.springframework.statemachine.config.AbstractStateMachineFactory.buildMachine(AbstractStateMachineFactory.java:941) ~[spring-statemachine-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at org.springframework.statemachine.config.AbstractStateMachineFactory.getStateMachine(AbstractStateMachineFactory.java:263) ~[spring-statemachine-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at org.springframework.statemachine.config.AbstractStateMachineFactory.getStateMachine(AbstractStateMachineFactory.java:148) ~[spring-statemachine-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]

Our project if fully "web flux ready". The only blocking call is this one.

Bambus
@vlatk0o

I want the state machine to be started at the start of the app. And after that it should go in the Re-State where on some time (Scheduled) it go in State GetOrders with SubStates (GetA, GetB and GetC). After that if there is some error it should go in the error, otherwise if everything is okay it should go in the Re-State where it should wait for the Scheduler.

This is my config:

@Override
    public void configure(StateMachineConfigurationConfigurer<States, Events> config) throws Exception {
        config.withConfiguration()
          .autoStartup(true)
          .machineId("orderMachine");
    }

And this is the method for the scheduler:

@Scheduled(cron = "0 0 1 1 * *")
    public void startStateMachine() {

        StateMachine<States, Events> sm = factory.getStateMachine();
        sm.start();
        sm.sendEvent(Events.ReState);
    }

Everything is working okay but I have noticed that every time this method executes, the stateMachine that is starting have different UUID with the previous one but the Id is same. So I think I am making multiple instances of the state machine. Is it possible to reuse the same state machine or not finishing the process. Because in my case most of the time the state of the machine should be in Re-State. It can be considered as waiting state.

The state machine flow is on the image below

probaUml.png
Pieter Martin
@pietermartin
Is it possible to load multiple state machines in one UML model?
Seems like the builder only builds one state machine even though it looks like it parsed all state machines in the root of the model.
Sherry Ummen
@sherry-ummen

Hey just a suggestion need:

how do you guys connect two independent state machines to each other ?

So example : StateMachine2, StateMachine3

And you need StateMachine1 which is equal to StateMachine2 -> StateMachine3

I thinking of two approaches

  • Passing the StateMachine1 context to StateMachine2 and StateMachine3 and then they take responsibility on calling the event
  • StateMachine2 and 3 both are taking StateMachine1 builder and adds to that state and return back. then on StateMachine1 it all could be stitched together

Any opinion or other options ?

Alok Kulkarni
@alokkulkarni
i add a dynamic transiton to my statemachine using stateMachine.getTransitions().add(new DefaultExternalStateMachine()) ……. then verified the count of transitions in the current statemachine… which shows my newly added transition + increased size. but when i pass the event for that transtion …. the event is accepted but my statemachine transtion is not persisted
any idea or help would really be appreciated
i am using mongoDBPersister
Fana Sithole
@fanaSA

Hello, I raised a Pull Request to add Reactive support for the StateMachineAccess class (this is in support of SSM 3.0.0) (spring-projects/spring-statemachine#912), as described in #911, and all the tests passed except for the org.springframework.statemachine.buildtests.TimerSmokeTests#testDeadlock. Looking at previous runs for the smoke tests, this test seems to fail quite often for Java8 Smoke Tests. The test passes when I run the exact gradle command on my local.

Is this test inherently unstable or am I missing something?

gte811i
@gte811i

I want to be notified when an particular event is not accepted by the state machine. I'm using annotation and I have @OnEventNotAccepted. This works when I do @OnEventNotAccepted(event = "MY_EVENT").

I have tried the method of using a new annotation @EventsOnEventNotAccepted following the same pattern for @OnTransition to @StatesOnTransistion (which I do have working). The final result is @EventsOnEventNotAccepted(event = Events.MY_EVENT) and this does not work. Any suggestions?

Ankit Gupta
@agupta92

How can I always transition to FULFILLMENT_ORDER_CANCELLED substate before transitioning to OrderState.CANCELLED state.

For Example: Support, I want to cancel an order. I would trigger event OrderEvent.CANCEL. With this event, Order should get cancelled and should end at OrderState.CANCELLED. But before cancel I want to transition to FULFILLMENT_ORDER_CANCELLED state and then to OrderState.CANCELLED.

Sample flow required is: Trigger OrderEvent.CANCEL -> OrderState.FULFILLMENT_ORDER_CANCELLED -> OrderState.CANCELLED.

This is required from all other states as well, whenever cancel gets trigger same flow should is needed.

states
.withStates()
.initial(OrderState.START)
.states(EnumSet.allOf(OrderState.class))
.end(OrderState.DELIVERED)
.end(OrderState.CANCELLED)
.and()
.withStates()
.parent(OrderState.CREATED)
.initial(OrderState.FULFILLMENT_ORDER_CREATED)
.state(OrderState.FULFILLMENT_ORDER_CREATED)
.state(OrderState.FULFILLMENT_ORDER_PROCESSING)
.state(OrderState.FULFILLMENT_ORDER_PENDING_FOR_STOCK)
.state(OrderState.FULFILLMENT_ORDER_PACKED)
.state(OrderState.FULFILLMENT_ORDER_INVOICED)
.state(OrderState.FULFILLMENT_ORDER_CANCELLED)
.and()
.withStates()
.parent(OrderState.DELIVERY_IN_PROCESS)
.state(OrderState.OUT_FOR_DELIVERY)
.state(OrderState.UNATTEMPTED);

transitions
.withExternal()
.source(OrderState.START).target(OrderState.CREATED).event(OrderEvent.CREATE)
.and()
.withExternal()
.source(OrderState.CREATED).target(OrderState.FULFILLMENT_ORDER_CREATED).event(OrderEvent.FULFILLMENT_ORDER_CREATE)
.and()
.withExternal()
.source(OrderState.FULFILLMENT_ORDER_CREATED).target(OrderState.FULFILLMENT_ORDER_PROCESSING).event(OrderEvent.FULFILLMENT_ORDER_PROCESS)
.and()
.withExternal()
.source(OrderState.FULFILLMENT_ORDER_PROCESSING).target(OrderState.FULFILLMENT_ORDER_PACKED).event(OrderEvent.FULFILLMENT_ORDER_PACKED)
.and()
.withExternal()
.source(OrderState.FULFILLMENT_ORDER_PACKED).target(OrderState.BILLED).event(OrderEvent.BILLED)
.and()
.withExternal()
.source(OrderState.BILLED).target(OrderState.DELIVERED).event(OrderEvent.DELIVERED)
.and()
.withExternal()
.source(OrderState.BILLED).target(OrderState.CANCELLED).event(OrderEvent.CANCEL);
```

Radu
@raduone
Hello. I am currently learning this Spring module. I am a bit confused regarding the distributed nature.
I understand that one approach that was done for distributed workflows involves Zookeper.
But I am curious about the persistence via JPA for example. I understand that just because
you enable persistence, it doesn't enable the distributed workflow to work, with JPA for example.
But what would be some use cases where you could use simple persistence like that ?
Mayur Kale
@DarkHorseDeveloper
Hey Guys, is this gitter still active? Just want to ask anyone has come across more complete examples of fork/join?
Pieter Martin
@pietermartin
This gitter does not seem to get answered for the last while no.
gte811i
@gte811i
Seems like there are lots of questions and very little answers. Maybe stackoverflow is better?
cloudhuang
@cloudhuang
Hi there, from the source code - return new UmlStateMachineModelFactory("classpath:ordershipping.uml");, it using the UML state state machine definition, but how to open this UML file?
hmunnin
@hmunnin
Hey guys, how i can enable @StateMachineJpaRepositoriesAutoConfiguration annotation?
Nuno Marujo
@nhmarujo

Hey guys. We have been trying to use the StateMachine with Mongo persistence, but so far is not working properly for us.

We setup the machineId as follow:

@Override
public void configure(StateMachineConfigurationConfigurer<AuthenticationStates, AuthenticationEvents> config) throws Exception {
    config.withConfiguration()
            .machineId("authentication-flow")
            .autoStartup(true)
            .withPersistence()
            .runtimePersister(stateMachineRuntimePersister);
}

But when the record is being persisted we noticed that id is the same as the machineId (both show as authentication-flow), when in fact it should be the uuid generated for that instance.

After a lot of debug we believe that there might be a bug in this line and it should pass (T)stateMachine.getUuid() instead of (T)stateMachine.getId().

Can you please take a look and assess if that is in fact a bug or help us understand what we might be configuring wrong?

474846718
@474846718
can statemachine support concurrent running?
Niranjan
@nnanda2016
Hi all, a newbie here. I have a situation where based on an action, i have to move the state machine to either SUCCESS or ERROR. How to achieve this? Is it possible to generate an event out of an action and move the state machine?
blindson76
@blindson76
Hey guys, how can i handle submachine's final state from parent and transit the parent machine to another state without knowing internal of submachine? I can do this by send even from the submachine to parent. But in some situations, it will not possible.