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
| ./sstabledump ~/.ccm/test/node1/data0/my_keyspace/orders-8b2e7e2022d111e9abc5abfbe212c0f3/mc-1-big-Data.db | |
| [ | |
| { | |
| "partition" : { | |
| "key" : [ "1" ], | |
| "position" : 0 | |
| }, | |
| "rows" : [ | |
| { | |
| "type" : "row", |
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
| INSERT INTO orders (id, status, country) VALUES ( 1, 'added', 'PL'); | |
| INSERT INTO orders (id, status, country) VALUES ( 1, 'verified', 'PL'); | |
| INSERT INTO orders (id, status, country) VALUES ( 1, 'shipped', 'PL'); |
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
| CREATE TABLE orders ( | |
| id int, | |
| status text, | |
| country text, | |
| PRIMARY KEY (id) | |
| ); |
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
| final case class UserCreatedEvent( | |
| userId: String = "", | |
| operationId: String = "", | |
| createdAt: Long = 0L, | |
| name: String = "", | |
| email: String = "" | |
| ) |
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
| "PackageStructureValidation" should "check no dependency from domain to application" in { | |
| // given | |
| val rule = noClasses().that().resideInAPackage("..domain..").should().accessClassesThat().resideInAPackage("..application..") | |
| // when // then | |
| rule.check(classes) | |
| } | |
| it should "check no dependency from domain to akka framework" in { |
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
| final case class User private[domain] (userId: UserId, createdAt: Instant, name: String, email: Email) { | |
| def applyEvent(userEvent: UserEvent): Try[User] = userEvent match { | |
| case _: UserCreated => Failure(new IllegalStateException("User already created. Event cannot be applied.")) | |
| case event: NameUpdated => Success(copy(name = event.newName)) | |
| case event: EmailUpdated => Success(copy(email = event.newEmail)) | |
| } | |
| def process(userCommand: UserCommand): Try[List[UserEvent]] = userCommand match { | |
| case _: CreateUser => Failure(new IllegalStateException("User already created. Command cannot be processed.")) |
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
| import javax.persistence.*; | |
| import java.util.List; | |
| import static java.util.Collections.unmodifiableList; | |
| import static javax.persistence.GenerationType.AUTO; | |
| @Entity | |
| public class Issue { | |
| @EmbeddedId |
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
| import org.axonframework.commandhandling.CommandHandler; | |
| import org.axonframework.commandhandling.model.AggregateIdentifier; | |
| import org.axonframework.eventsourcing.EventSourcingHandler; | |
| import org.axonframework.samples.trader.api.users.*; | |
| import org.axonframework.samples.trader.users.util.DigestUtils; | |
| import org.axonframework.spring.stereotype.Aggregate; | |
| import static org.axonframework.commandhandling.model.AggregateLifecycle.apply; | |
| @Aggregate(repository = "userAggregateRepository") |
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
| import akka.Done | |
| import com.lightbend.lagom.scaladsl.persistence.{AggregateEvent, AggregateEventTag, AggregateEventTagger, PersistentEntity} | |
| import play.api.libs.json.{Format, Json} | |
| import com.example.auction.utils.JsonFormats._ | |
| import com.lightbend.lagom.scaladsl.api.transport.{TransportErrorCode, TransportException} | |
| import com.lightbend.lagom.scaladsl.persistence.PersistentEntity.ReplyType | |
| class AuctionEntity extends PersistentEntity { | |
| import AuctionStatus._ | |
| ... |
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
| val eventJournal = PersistenceQuery(system).readJournalFor[CassandraReadJournal](CassandraReadJournal.Identifier) | |
| eventJournal | |
| .eventsByPersistenceId(persistenceId, startingSequenceNr, Long.MaxValue) | |
| .via(updateSingleReadModel) | |
| .mapAsync(1)(saveSequnceNr) |