Skip to content

Commit

Permalink
Change TCP Decoder and Encoder (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanwenjun authored Dec 1, 2021
1 parent c76e563 commit 35a0181
Show file tree
Hide file tree
Showing 33 changed files with 315 additions and 367 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,16 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class EventMeshMessage {

private String topic;
Map<String, String> properties = new ConcurrentHashMap<>();
private String body;

public EventMeshMessage() {
}

public EventMeshMessage(String topic, Map<String, String> properties, String body) {
this.topic = topic;
this.properties = properties;
this.body = body;
}

public String getTopic() {
return topic;
}
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

public void setTopic(String topic) {
this.topic = topic;
}

public Map<String, String> getProperties() {
return properties;
}

public void setProperties(Map<String, String> properties) {
this.properties = properties;
}

public String getBody() {
return body;
}

public void setBody(String body) {
this.body = body;
}
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EventMeshMessage {

@Override
public String toString() {
return "EventMeshMessage{" +
"topic='" + topic + '\'' +
", properties=" + properties +
", body='" + body + '\'' +
'}';
}
private String topic;
private Map<String, String> properties = new ConcurrentHashMap<>();
private String body;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
import java.util.HashMap;
import java.util.Map;

import lombok.Data;

@Data
public class Header {

private Command cmd;
private int code;
private String desc;
private String seq;
private Map<String, Object> properties;
private Command cmd;
private int code;
private String desc;
private String seq;
private Map<String, Object> properties = new HashMap<>();

public Header() {
}
Expand All @@ -45,6 +48,7 @@ public Header(int code, String desc, String seq, Map<String, Object> properties)
this.properties = properties;
}


public Command getCommand() {
return cmd;
}
Expand Down Expand Up @@ -97,18 +101,7 @@ public Object getProperty(final String name) {
if (null == this.properties) {
this.properties = new HashMap<>();
}

return this.properties.get(name);
}

@Override
public String toString() {
return "Header{" +
"cmd=" + cmd +
", code=" + code +
", desc='" + desc + '\'' +
", seq='" + seq + '\'' +
", properties=" + properties +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,20 @@

import org.apache.eventmesh.common.protocol.ProtocolTransportObject;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Package implements ProtocolTransportObject {

private Header header;
private Object body;

public Package() {
}

public Package(Header header) {
this.header = header;
}

public Package(Header header, Object body) {
this.header = header;
this.body = body;
}
}
Loading

0 comments on commit 35a0181

Please sign in to comment.