This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Tha main Event sourcing DDD aggregate class for order domain which handle the order commands within it is boundary context | |
* | |
* @author romeh | |
*/ | |
@PersistentActor | |
public class OrderManager extends PersistentEntity<OrderCmd, OrderEvent, OrderState> { | |
/** | |
* how to handle supervisor strategy definition for the parent actor of the entity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* the main order entity required configuration for event souring toolkit | |
*/ | |
@Component | |
public class OrderEntityProperties implements PersistentEntityProperties<OrderManager, OrderCmd, OrderEvent> { | |
private Map<Class<? extends OrderEvent>, String> tags; | |
/** | |
* init the event tags map | |
*/ | |
@PostConstruct |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring: | |
jackson: | |
default-property-inclusion: non_null | |
akka: | |
config: eventSourcing.conf | |
system-name: orderManagerSystem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get order state service API | |
* | |
* @param getOrderStatusCmd get Order state command | |
* @return order state | |
*/ | |
public CompletableFuture<OrderState> getOrderStatus(OrderCmd.GetOrderStatusCmd getOrderStatusCmd) { | |
return PatternsCS.ask(getOrderEntity(), getOrderStatusCmd, timeout).toCompletableFuture() | |
.thenApply(handleGetState); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The main order domain REST API | |
* | |
* @author romeh | |
*/ | |
@RestController | |
@RequestMapping("/orders") | |
@Api(value = "Order Manager REST API demo") | |
public class OrderRestController { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.xolstice.maven.plugins</groupId> | |
<artifactId>protobuf-maven-plugin</artifactId> | |
<version>0.5.1</version> | |
<configuration> | |
<protocExecutable>/usr/local/opt/protobuf/bin/protoc</protocExecutable> | |
</configuration> | |
<executions> | |
<execution> | |
<goals> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>ru.yandex.qatools.embed</groupId> | |
<artifactId>postgresql-embedded</artifactId> | |
<version>2.9</version> | |
</dependency> | |
<dependency> | |
<groupId>org.postgresql</groupId> | |
<artifactId>postgresql</artifactId> | |
<scope>runtime</scope> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* the db spring configuration to use in production , to be replaced with actual production configuration , that is for local run only | |
*/ | |
@Configuration | |
@EnableTransactionManagement | |
public class DbConfig { | |
private static final List<String> DEFAULT_ADDITIONAL_INIT_DB_PARAMS = Arrays | |
.asList("--nosync", "--locale=en_US.UTF-8"); | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity(name = "customer") | |
@Data | |
@AllArgsConstructor | |
@NoArgsConstructor | |
@Builder | |
public class Customer { | |
@Id | |
private long id; | |
private String name; | |
private String address; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* main customer repository | |
*/ | |
@Repository | |
@Transactional | |
public interface CustomerRepository extends CrudRepository<Customer, Long> { | |
Optional<Customer> findCustomerByName(String name); | |
} |