Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Lombok #192

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
</properties>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sqs</artifactId>
Expand Down Expand Up @@ -109,13 +104,6 @@
<source>17</source>
<target>17</target>
<encoding>UTF-8</encoding>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,12 @@

import jakarta.jms.Destination;
import jakarta.jms.Queue;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;

/**
* A SQSQueueDestination object encapsulates a queue name and SQS specific queue
* URL. This is the way a client specifies the identity of a queue to JMS API
* methods.
*/
@Getter
@ToString(exclude = {"isFifo"})
@EqualsAndHashCode
public class SQSQueueDestination implements Destination, Queue {

private final String queueName;
Expand All @@ -41,4 +35,60 @@ public class SQSQueueDestination implements Destination, Queue {
this.queueUrl = queueUrl;
this.isFifo = this.queueName.endsWith(".fifo");
}

/**
* Returns the name of this queue.
*
* @return queueName
*/
@Override
public String getQueueName() {
return this.queueName;
}

/**
* Returns the queueUrl of this queue.
*
* @return queueUrl
*/
public String getQueueUrl() {
return this.queueUrl;
}

public boolean isFifo() {
return this.isFifo;
}

@Override
public String toString() {
return "SQSDestination [queueName=" + queueName + ", queueUrl=" + queueUrl + "]";
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((queueName == null) ? 0 : queueName.hashCode());
result = prime * result + ((queueUrl == null) ? 0 : queueUrl.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SQSQueueDestination other = (SQSQueueDestination) obj;
if (queueName == null) {
if (other.queueName != null)
return false;
} else if (!queueName.equals(other.queueName))
return false;
if (queueUrl == null) {
return other.queueUrl == null;
} else return queueUrl.equals(other.queueUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,19 @@

import com.amazon.sqs.javamessaging.message.SQSMessage;
import jakarta.jms.JMSException;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;

/**
* Identifies an SQS message, when (negative)acknowledging the message
*/
@ToString(onlyExplicitlyIncluded = true)
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@Getter
public class SQSMessageIdentifier {

// The queueUrl where the message was sent or received from
@ToString.Include
@EqualsAndHashCode.Include
private final String queueUrl;

// The receipt handle returned after the delivery of the message from SQS
@ToString.Include
@EqualsAndHashCode.Include
private final String receiptHandle;

// The SQS message id assigned on send.
@ToString.Include
@EqualsAndHashCode.Include
private final String sqsMessageId;

// The group id to which the message belongs
Expand All @@ -63,4 +51,81 @@ public SQSMessageIdentifier(String queueUrl, String receiptHandle, String sqsMes
public static SQSMessageIdentifier fromSQSMessage(SQSMessage sqsMessage) throws JMSException {
return new SQSMessageIdentifier(sqsMessage.getQueueUrl(), sqsMessage.getReceiptHandle(), sqsMessage.getSQSMessageId(), sqsMessage.getSQSMessageGroupId());
}

/**
* Returns the queueUrl where the message was sent or received from.
*
* @return queueUrl
*/
public String getQueueUrl() {
return this.queueUrl;
}

/**
* Returns the receipt handle returned after the delivery of the message
* from SQS.
*
* @return receiptHandle
*/
public String getReceiptHandle() {
return this.receiptHandle;
}

/**
* Returns the SQS message id assigned on send.
*
* @return sqsMessageId
*/
public String getSQSMessageID() {
return this.sqsMessageId;
}

/**
* Returns the group id to which the message belongs. Non-null only for messages received from FIFO queues.
*
* @return groupId
*/
public String getGroupId() {
return this.groupId;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((queueUrl == null) ? 0 : queueUrl.hashCode());
result = prime * result + ((receiptHandle == null) ? 0 : receiptHandle.hashCode());
result = prime * result + ((sqsMessageId == null) ? 0 : sqsMessageId.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SQSMessageIdentifier other = (SQSMessageIdentifier) obj;
if (queueUrl == null) {
if (other.queueUrl != null)
return false;
} else if (!queueUrl.equals(other.queueUrl))
return false;
if (receiptHandle == null) {
if (other.receiptHandle != null)
return false;
} else if (!receiptHandle.equals(other.receiptHandle))
return false;
if (sqsMessageId == null) {
return other.sqsMessageId == null;
} else return sqsMessageId.equals(other.sqsMessageId);
}

@Override
public String toString() {
vpavic marked this conversation as resolved.
Show resolved Hide resolved
return "SQSMessageIdentifier [queueUrl=" + queueUrl + ", receiptHandle=" + receiptHandle +
", sqsMessageId=" + sqsMessageId + "]";
}
}