Skip to content

Commit

Permalink
⬇️ Downgrading dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
crossoverJie committed May 7, 2018
1 parent 7bb52be commit cbfae5d
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 8 deletions.
8 changes: 1 addition & 7 deletions SSM-SECONDS-KILL/SSM-SECONDS-KILL-ORDER-CONSUMER/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.crossoverjie.kafka</groupId>
<artifactId>order-consumer</artifactId>
<version>0.0.2-SNAPSHOT</version>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>order-consumer</name>
Expand Down Expand Up @@ -84,12 +84,6 @@
</exclusions>
</dependency>

<dependency>
<groupId>com.crossoverJie</groupId>
<artifactId>SSM-SECONDS-KILL-API</artifactId>
<version>2.2.0-SNAPSHOT</version>
</dependency>


<dependency>
<groupId>com.alibaba</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.crossoverjie.kafka.orderconsumer.dto;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.kafka.common.errors.SerializationException;
import org.apache.kafka.common.serialization.Serializer;

import java.util.Map;


public class JsonSerializer<T> implements Serializer<T> {

public JsonSerializer() {

}


@Override
public void configure(Map<String, ?> configs, boolean isKey) {
// No-op
}

@Override
public byte[] serialize(String topic, T data) {
try {
byte[] result = null;
if (data != null) {

result = JSONObject.toJSONBytes(data,
SerializerFeature.UseISO8601DateFormat,
SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteClassName);
}
return result;
} catch (Exception ex) {
throw new SerializationException("Can't serialize data [" + data + "] for topic [" + topic + "]", ex);
}
}

@Override
public void close() {
// No-op
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.crossoverjie.kafka.orderconsumer.dto;

import java.io.Serializable;

/**
* @author crossoverJie
*/
public class Stock implements Serializable{
private static final long serialVersionUID = -8437012513227627973L;
private Integer id;

private String name;

private Integer count;

private Integer sale;

private Integer version;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Integer getCount() {
return count;
}

public void setCount(Integer count) {
this.count = count;
}

public Integer getSale() {
return sale;
}

public void setSale(Integer sale) {
this.sale = sale;
}

public Integer getVersion() {
return version;
}

public void setVersion(Integer version) {
this.version = version;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.crossoverJie.seconds.kill.api.dto.Stock;
import com.crossoverjie.kafka.orderconsumer.dto.Stock;
import com.crossoverjie.kafka.orderconsumer.util.SpringBeanFactory;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.consumer.ConsumerRecord;
Expand Down

0 comments on commit cbfae5d

Please sign in to comment.