All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.evento.common.modeling.messaging.dto.PublishedEvent Maven / Gradle / Ivy

The newest version!
package com.evento.common.modeling.messaging.dto;


import com.evento.common.modeling.messaging.message.application.EventMessage;

import java.io.Serializable;


/**
 * The PublishedEvent class represents a published event in the event sourcing architecture.
 * It contains information about the event sequence number, aggregate ID, event message, event name, and creation timestamp.
 */
public class PublishedEvent implements Serializable {
	private Long eventSequenceNumber;
	private String aggregateId;
	private EventMessage eventMessage;
	private String eventName;
	private Long createdAt;

	/**
	 * Retrieves the event sequence number of a PublishedEvent.
	 *
	 * @return the event sequence number of the PublishedEvent.
	 */
	public Long getEventSequenceNumber() {
		return eventSequenceNumber;
	}

	/**
	 * Sets the event sequence number for a PublishedEvent object.
	 *
	 * @param eventSequenceNumber the event sequence number to be set
	 */
	public void setEventSequenceNumber(Long eventSequenceNumber) {
		this.eventSequenceNumber = eventSequenceNumber;
	}

	/**
	 * Retrieves the aggregate ID of the PublishedEvent.
	 *
	 * @return the aggregate ID of the PublishedEvent as a String.
	 */
	public String getAggregateId() {
		return aggregateId;
	}

	/**
	 * Sets the aggregate ID of the PublishedEvent.
	 * 

* The aggregate ID is a unique identifier for an aggregate in the event sourcing architecture. * It is typically a string value that uniquely identifies an aggregate instance. * The aggregate ID can be set using the setAggregateId method and retrieved using the getAggregateId method. * * @param aggregateId the aggregate ID to be set as a String * * @see PublishedEvent#getAggregateId() */ public void setAggregateId(String aggregateId) { this.aggregateId = aggregateId; } /** * Retrieves the event message of the PublishedEvent. * * @return the event message of the PublishedEvent. */ public EventMessage getEventMessage() { return eventMessage; } /** * Sets the event message of the PublishedEvent. *

* This method allows you to set the event message for a PublishedEvent object. * The event message represents a message containing an event payload. * It should be an instance of EventMessage or its subtypes. * Once set, the event message can be retrieved using the getEventMessage method. *

* Usage example: *

{@code
	 * PublishedEvent event = new PublishedEvent();
	 * EventMessage eventMessage = new EventMessage<>(new MyEventPayload());
	 * event.setEventMessage(eventMessage);
	 * }
* * @param eventMessage the event message to be set for the PublishedEvent * @see PublishedEvent#getEventMessage() * @see EventMessage */ public void setEventMessage(EventMessage eventMessage) { this.eventMessage = eventMessage; } /** * Retrieves the creation timestamp of the PublishedEvent. * * @return the creation timestamp of the PublishedEvent as a Long */ public Long getCreatedAt() { return createdAt; } /** * Sets the creation timestamp of the PublishedEvent. * * @param createdAt the creation timestamp to be set as a Long */ public void setCreatedAt(Long createdAt) { this.createdAt = createdAt; } /** * Retrieves the event name of the PublishedEvent. * * @return the event name of the PublishedEvent as a String. */ public String getEventName() { return eventName; } /** * Sets the event name of the PublishedEvent. * * @param eventName the event name to be set as a String */ public void setEventName(String eventName) { this.eventName = eventName; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy