Java Code Examples for org.springframework.tuple.Tuple#getString()
The following examples show how to use
org.springframework.tuple.Tuple#getString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BoardEventNotificationSink.java From event-store-demo with GNU General Public License v3.0 | 6 votes |
@StreamListener( Sink.INPUT ) public void processNotification( final String json ) { log.debug( "processNotification : enter" ); Tuple event = TupleBuilder.fromString( json ); Assert.hasText( event.getString( "eventType" ), "eventType not set" ); Assert.hasText( event.getString( "boardUuid" ), "boardUuid not set" ); Assert.hasText( event.getString( "occurredOn" ), "occurredOn not set" ); String eventType = event.getString( "eventType" ); if( eventType.equals( "BoardInitialized" ) ) { log.debug( "processNotification : exit, no board should exist in cache if 'BoardInitialized' event is received" ); return; } this.service.uncacheTarget( UUID.fromString( event.getString( "boardUuid" ) ) ); log.debug( "processNotification : exit" ); }
Example 2
Source File: DomainEventService.java From event-store-demo with GNU General Public License v3.0 | 6 votes |
@Transactional public void processDomainEvent( final Tuple event ) { log.debug( "processDomainEvent : enter" ); log.debug( "processDomainEvent : event[{}] ", event ); String eventType = event.getString( "eventType" ); switch ( eventType ) { case "BoardInitialized": processBoardInitialized( event ); break; default: processBoardEvent( event ); break; } log.debug( "processDomainEvent : calling publisher.sendNotification( event )" ); this.publisher.sendNotification( event ); log.debug( "processDomainEvent : exit" ); }
Example 3
Source File: DomainEventService.java From event-store-demo with GNU General Public License v3.0 | 4 votes |
private void processBoardInitialized( final Tuple event ) { log.debug( "processBoardInitialized : enter " ); String boardUuid = event.getString( "boardUuid" ); DomainEventsEntity domainEventsEntity = new DomainEventsEntity( boardUuid ); DomainEventEntity domainEventEntity = new DomainEventEntity(); domainEventEntity.setId( UUID.randomUUID().toString() ); Instant occurredOn = Instant.parse( event.getString( "occurredOn" ) ); domainEventEntity.setOccurredOn( LocalDateTime.ofInstant( occurredOn, ZoneOffset.UTC ) ); domainEventEntity.setData( this.toJsonStringConverter.convert( event ) ); domainEventsEntity.getDomainEvents().add( domainEventEntity ); this.domainEventsRepository.save( domainEventsEntity ); }
Example 4
Source File: DomainEventService.java From event-store-demo with GNU General Public License v3.0 | 4 votes |
private void processBoardEvent( final Tuple event ) { log.debug( "processBoardEvent : enter " ); String boardUuid = event.getString( "boardUuid" ); this.domainEventsRepository.findById( boardUuid ) .ifPresent( found -> { log.debug( "processBoardEvent : a DomainEventsEntity[{}] was found for boardUuid[{}]. ", found, boardUuid ); DomainEventEntity domainEventEntity = new DomainEventEntity(); domainEventEntity.setId( UUID.randomUUID().toString() ); Instant occurredOn = Instant.parse( event.getString( "occurredOn" ) ); domainEventEntity.setOccurredOn( LocalDateTime.ofInstant( occurredOn, ZoneOffset.UTC ) ); domainEventEntity.setData( toJsonStringConverter.convert( event ) ); found.getDomainEvents().add( domainEventEntity ); this.domainEventsRepository.save( found ); }); }