本文整理汇总了Java中com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry类的典型用法代码示例。如果您正苦于以下问题:Java PersistentEntityRegistry类的具体用法?Java PersistentEntityRegistry怎么用?Java PersistentEntityRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistentEntityRegistry类属于com.lightbend.lagom.javadsl.persistence包,在下文中一共展示了PersistentEntityRegistry类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: InventoryServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
@Inject
public InventoryServiceImpl(PersistentEntityRegistry registry, BasketService basketService) {
this.registry = registry;
this.basketService = basketService;
registry.register(InventoryEntity.class);
// this solution is naïve on the approach and wrong altogether in the implementation
// a) when applying a filter in the akka stream, the message is missaligned with the offset
// b) updating the inventory should be handled in a way that if a product is out of stock an event is
// raised and the shppoing-user is notified so she can decide what to do. Also, the out-of-stock product
// must be reimbursed. All this corrective actions are not implemented, on the contrary: when the
// InventoryEntity detects there's not enough stock for a given Deacrease operation an exception is throw.
// Instead, an event other downstream services can listen to would be more appropriate.
// I will try to get (a) fixed on further versions of this workshop.
//
basketService.basketEvents().subscribe().atLeastOnce(
Flow.<BasketEvent>create()
.filter(b -> b instanceof BasketEvent.BasketCheckedOut)
.mapConcat(basketEvent -> {
BasketEvent.BasketCheckedOut event = (BasketEvent.BasketCheckedOut) basketEvent;
return event.getBasket().getItems();
})
.mapAsync(1, basketItem ->
refFor(basketItem.getId())
.ask(new DecreaseInventory(basketItem.getId(), basketItem.getCount()))
).map(ignored -> Done.getInstance())
);
}
示例2: FriendServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
@Inject
public FriendServiceImpl(PersistentEntityRegistry persistentEntities, ReadSide readSide,
CassandraSession db) {
this.persistentEntities = persistentEntities;
this.db = db;
persistentEntities.register(FriendEntity.class);
readSide.register(FriendEventProcessor.class);
}
示例3: ChirpServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
@Inject
public ChirpServiceImpl(PersistentEntityRegistry persistentEntities, ChirpTopic topic, ChirpRepository chirps) {
this.persistentEntities = persistentEntities;
this.topic = topic;
this.chirps = chirps;
persistentEntities.register(ChirpTimelineEntity.class);
}
示例4: RegistrationServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
/**
* Constructor with the relevant infrastructure elements injected.
*
* @param topics
* @param persistentEntityRegistry
* @param readSide
* @param db
*/
@Inject
public RegistrationServiceImpl(PubSubRegistry topics, PersistentEntityRegistry persistentEntityRegistry, CassandraReadSide readSide,
CassandraSession db) {
this.persistentEntityRegistry = persistentEntityRegistry;
this.topics = topics;
this.db = db;
persistentEntityRegistry.register(CargoEntity.class);
readSide.register(CargoEventProcessor.class);
}
示例5: FriendServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
@Inject
public FriendServiceImpl(PersistentEntityRegistry persistentEntities, CassandraReadSide readSide,
CassandraSession db) {
this.persistentEntities = persistentEntities;
this.db = db;
persistentEntities.register(FriendEntity.class);
readSide.register(FriendEventProcessor.class);
}
示例6: FavoriteServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
@Inject
public FavoriteServiceImpl(PersistentEntityRegistry persistentEntities,
CassandraReadSide readSide,
CassandraSession db) {
this.persistentEntities = persistentEntities;
this.persistentEntities.register(FavoriteEntity.class);
this.db = db;
readSide.register(FavoriteEventProcessor.class);
}
示例7: BasketServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
@Inject
public BasketServiceImpl(PersistentEntityRegistry registry) {
this.registry = registry;
registry.register(com.example.basket.impl.BasketEntity.class);
}
示例8: HelloServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
@Inject
public HelloServiceImpl(PersistentEntityRegistry persistentEntityRegistry) {
this.persistentEntityRegistry = persistentEntityRegistry;
persistentEntityRegistry.register(HelloEntity.class);
}
示例9: ShippingServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
@Inject
public ShippingServiceImpl(PersistentEntityRegistry persistentEntityRegistry, RegistrationService registrationService) {
this.persistentEntityRegistry = persistentEntityRegistry;
this.registrationService = registrationService;
persistentEntityRegistry.register(ItineraryEntity.class);
}
示例10: BlogServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
@Inject
public BlogServiceImpl(final PersistentEntityRegistry registry) {
this.registry = registry;
registry.register(BlogEntity.class);
}
示例11: HelloServiceImpl
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; //导入依赖的package包/类
@Inject
public HelloServiceImpl(PersistentEntityRegistry persistentEntityRegistry) {
this.persistentEntityRegistry = persistentEntityRegistry;
persistentEntityRegistry.register(HelloEntity.class);
}