Skip to content

Commit

Permalink
Merge pull request #11 from 2060-io/dev
Browse files Browse the repository at this point in the history
2.0.7
  • Loading branch information
mjfelis authored Apr 29, 2024
2 parents d1265b7 + 42a6b5b commit ce1205d
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.2060</groupId>
<artifactId>service-agent-java-client</artifactId>
<version>2.0.6</version>
<version>2.0.7</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
Expand Down
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
@@ -0,0 +1,28 @@
package io.twentysixty.sa.client.res.c.v1;

import java.util.List;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;

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

@Path("")
public interface CredentialTypeInterface {

@POST
@Path("/v1/credential-types")
@Produces("application/json")
public void createCredentialType(CredentialType credentialType);


@GET
@Path("/v1/credential-types")
@Produces("application/json")
public List<CredentialType> getAllCredentialTypes();



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.twentysixty.sa.client.res.c.v1;

import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;

import io.twentysixty.sa.client.model.message.BaseMessage;
import io.twentysixty.sa.client.model.message.IdMessage;

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

@POST
@Path("/v1/message")
@Produces("application/json")
public IdMessage sendMessage(BaseMessage message);
}
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 ce1205d

Please sign in to comment.