Skip to content

camunda-community-hub/vanillabp-camunda8-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compatible with: Camunda Platform 8

Maven Central Apache License V.2

VanillaBP

Camunda 8 adapter

This is an adapter which implements the binding of the VanillaBP SPI in order to run business processes using Camunda 8.

If you are interested in migrating from Camunda 7 then checkout the drop-in replacement adapter for Camunda 7 as well as the documentation of migration scenarios.

Runtime environments

Currently, only Spring Boot is supported by including this Maven dependency:

<dependency>
  <groupId>org.camunda.community.vanillabp</groupId>
  <artifactId>camunda8-spring-boot-adapter</artifactId>
</dependency>

To learn about details of the adapter checkout the module's README.

How it looks like

This is a section of a taxi ride workflow and should give you an idea of how the VanillaBP SPI is used in your business code. To learn more about VanillaBP checkout the SPI documentation.

Section of a taxi ride workflow
Screenshot of Camunda Modeler

@Service
@WorkflowService(workflowAggregateClass = Ride.class)
@Transactional(noRollbackFor = TaskException.class)
public class TaxiRide {
    
    @Autowired
    private ProcessService<Ride> processService;
    
    public String rideBooked(
            final Location pickupLocation,
            final OffsetDateTime pickupTime,
            final Location targetLocation) {
        
        final var ride = new Ride();
        ...
        // start the workflow by correlation of the message start event
        return processService
                .correlateMessage(ride, "RideBooked")
                .getRideId();
    }
    
    @WorkflowTask
    public void determinePotentialDrivers(
            final Ride ride) {
        
        final var parameters = new DriversNearbyParameters()
                .longitude(ride.getPickupLocation().getLongitude())
                .latitude(ride.getPickupLocation().getLatitude());

        final var potentialDrivers = driverService
                .determineDriversNearby(parameters);

        ride.setPotentialDrivers(
                mapper.toDomain(potentialDrivers, ride));
    }

    @WorkflowTask
    public void requestRideOfferFromDriver(
            final Ride ride,
            @MultiInstanceIndex("RequestRideOffer")
            final int potentialDriverIndex) {
        
        final var driver = ride.getPotentialDrivers().get(potentialDriverIndex);
        
        driverService.requestRideOffer(
                driver.getId(),
                new RequestRideOfferParameters()
                        .rideId(ride.getRideId())
                        .pickupLocation(mapper.toApi(ride.getPickupLocation()))
                        .pickupTime(ride.getPickupTime())
                        .targetLocation(mapper.toApi(ride.getTargetLocation())));
        
    }
    ...

Noteworthy & Contributors

VanillaBP was developed by Phactum with the intention of giving back to the community as it has benefited the community in the past.

Phactum

License

Copyright 2022 Phactum Softwareentwicklung GmbH

Licensed under the Apache License, Version 2.0

About

This is an adapter which implements the binding of the VanillaBP SPI in order to run business processes using Camunda 8.

Resources

License

Stars

Watchers

Forks

Languages