Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
mjfelis committed Apr 29, 2024
1 parent 231f399 commit 42a6b5b
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.twentysixty.sa.client.jms;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
Expand All @@ -20,7 +21,7 @@
import io.twentysixty.sa.client.util.JsonUtil;


public abstract class AbstractProducer implements ProducerInterface {
public abstract class AbstractProducer<M extends Serializable> implements ProducerInterface<M> {

private Integer producerId = 0;
private Integer producerCount = 8;
Expand Down Expand Up @@ -108,7 +109,7 @@ public void setProducerCount(Integer producerCount) {
this.producerCount = producerCount;
}

public void spool(BaseMessage sms, int attempt) throws Exception {
public void spool(M sms, int attempt) throws Exception {

JMSProducer producer = null;
JMSContext context = null;
Expand Down Expand Up @@ -194,7 +195,7 @@ public void setDebug(Boolean debug) {
}

@Override
public void sendMessage(BaseMessage message) throws Exception {
public void sendMessage(M message) throws Exception {
// TODO Auto-generated method stub

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package io.twentysixty.sa.client.jms;

import io.twentysixty.sa.client.model.message.BaseMessage;
import java.io.Serializable;

public interface ProducerInterface {
public interface ProducerInterface<M extends Serializable> {


public void setExDelay(Long exDelay);
public void setQueueName(String queueName);
public void setThreads(Integer threads);
public void setDebug(Boolean debug);

public void sendMessage(BaseMessage message) throws Exception;
public void sendMessage(M message) throws Exception;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export enum DidExchangeState {
RESPONSE_RECEIVED("response-received"),
ABANDONED("abandoned"),
COMPLETED("completed"),
TERMINATED("terminated"),

;

Expand All @@ -57,6 +58,7 @@ public static DidExchangeState getEnum(String index){
else if (index.equals("response-received")) return RESPONSE_RECEIVED;
else if (index.equals("abandoned")) return ABANDONED;
else if (index.equals("completed")) return COMPLETED;
else if (index.equals("terminated")) return TERMINATED;
else return null;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@

})

public class Event implements Serializable {
public class Event implements Serializable {

private static final long serialVersionUID = -3403163200817960597L;

private String type;

@JsonSerialize(using = InstantSerializer.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
public class MessageReceived extends Event implements Serializable {


private static final long serialVersionUID = 8579005132408573827L;
private BaseMessage message;

public BaseMessage getMessage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Deprecated
public class TerminateConnectionMessage extends BaseMessage implements Serializable {

private static final long serialVersionUID = -2840211856886973672L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import io.twentysixty.sa.client.model.credential.CredentialType;

@Path("/v1")
public interface CredentialTypeInterface {

@POST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import io.twentysixty.sa.client.model.message.BaseMessage;
import io.twentysixty.sa.client.model.message.IdMessage;

@Path("/v1")
public interface MessageInterface { //cambiar void

@POST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import io.twentysixty.sa.client.model.event.ConnectionStateUpdated;

@Path("/v1")
public interface ConnectionEventInterface {

@POST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import io.twentysixty.sa.client.model.event.MessageReceived;
import io.twentysixty.sa.client.model.event.MessageStateUpdated;

@Path("/v1")
public interface MessageEventInterface {

@POST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.fasterxml.jackson.core.JsonProcessingException;

import io.twentysixty.sa.client.model.message.BaseMessage;
import io.twentysixty.sa.client.model.message.TextMessage;
import io.twentysixty.sa.client.util.JsonUtil;

Expand All @@ -17,7 +18,7 @@ public static void main(String[] args) throws JsonProcessingException {
textMessage.setId(UUID.randomUUID());
textMessage.setThreadId(UUID.randomUUID());
textMessage.setTimestamp(Instant.now());
System.out.println(JsonUtil.serialize(textMessage, false));
System.out.println(JsonUtil.serialize((BaseMessage)textMessage, true));

}

Expand Down

0 comments on commit 42a6b5b

Please sign in to comment.