Commit a7082f4b by zhangjw

新增ActiveMQ订阅VSS事件并解析

parent 09cb220d
......@@ -20,14 +20,60 @@
<groupId>com.chanjx</groupId>
<artifactId>chanjx-utils</artifactId>
</dependency>
<!--引入微服务启动依赖 starter
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-activemq</artifactId>-->
<!--&lt;!&ndash; <version>1.5.22.RELEASE</version>&ndash;&gt;-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.activemq</groupId>-->
<!-- <artifactId>activemq-pool</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-starter-cloud</artifactId>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.7.0</version>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-starter-job</artifactId>
</dependency>-->
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.2</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.12.0:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.32.1:exe:${os.detected.classifier}</pluginArtifact>
<protoSourceRoot>src/main/proto</protoSourceRoot>
<outputDirectory>src/main/java</outputDirectory>
<clearOutputDirectory>false</clearOutputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: comm.proto
package org.jeecg.modules.pm.entity.eps;
public final class Comm {
private Comm() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public enum EventState
implements com.google.protobuf.ProtocolMessageEnum {
EVENT_STATE_INSTANT(0, 0),
EVENT_STATE_START(1, 1),
EVENT_STATE_STOP(2, 2),
EVENT_STATE_PULSE(3, 3),
EVENT_STATE_UPDATE(4, 4),
;
public final int getNumber() { return value; }
public static EventState valueOf(int value) {
switch (value) {
case 0: return EVENT_STATE_INSTANT;
case 1: return EVENT_STATE_START;
case 2: return EVENT_STATE_STOP;
case 3: return EVENT_STATE_PULSE;
case 4: return EVENT_STATE_UPDATE;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<EventState>
internalGetValueMap() {
return internalValueMap;
}
private static com.google.protobuf.Internal.EnumLiteMap<EventState>
internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<EventState>() {
public EventState findValueByNumber(int number) {
return EventState.valueOf(number)
; }
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
return getDescriptor().getValues().get(index);
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return Comm.getDescriptor().getEnumTypes().get(0);
}
private static final EventState[] VALUES = {
EVENT_STATE_INSTANT, EVENT_STATE_START, EVENT_STATE_STOP, EVENT_STATE_PULSE, EVENT_STATE_UPDATE,
};
public static EventState valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
return VALUES[desc.getIndex()];
}
private final int index;
private final int value;
private EventState(int index, int value) {
this.index = index;
this.value = value;
}
static {
Comm.getDescriptor();
}
// @@protoc_insertion_point(enum_scope:org.jeecg.modules.pm.entity.eps.EventState)
}
public enum MsgCmdType
implements com.google.protobuf.ProtocolMessageEnum {
MSG_CMD_TYPE_MASK(0, 65280),
MSG_CMD_MANUAL_EVENT(1, 257),
MSG_CMD_CONFIRM_EVENT(2, 258),
MSG_CMD_REPORT_EVENT(3, 513),
MSG_CMD_SUBRECV_EVENT(4, 514),
MSG_CMD_EVENT_NOTIFY_REQ(5, 769),
MSG_CMD_EVENT_NOTIFY_RSP(6, 770),
;
public final int getNumber() { return value; }
public static MsgCmdType valueOf(int value) {
switch (value) {
case 65280: return MSG_CMD_TYPE_MASK;
case 257: return MSG_CMD_MANUAL_EVENT;
case 258: return MSG_CMD_CONFIRM_EVENT;
case 513: return MSG_CMD_REPORT_EVENT;
case 514: return MSG_CMD_SUBRECV_EVENT;
case 769: return MSG_CMD_EVENT_NOTIFY_REQ;
case 770: return MSG_CMD_EVENT_NOTIFY_RSP;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<MsgCmdType>
internalGetValueMap() {
return internalValueMap;
}
private static com.google.protobuf.Internal.EnumLiteMap<MsgCmdType>
internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<MsgCmdType>() {
public MsgCmdType findValueByNumber(int number) {
return MsgCmdType.valueOf(number)
; }
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
return getDescriptor().getValues().get(index);
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return Comm.getDescriptor().getEnumTypes().get(1);
}
private static final MsgCmdType[] VALUES = {
MSG_CMD_TYPE_MASK, MSG_CMD_MANUAL_EVENT, MSG_CMD_CONFIRM_EVENT, MSG_CMD_REPORT_EVENT, MSG_CMD_SUBRECV_EVENT, MSG_CMD_EVENT_NOTIFY_REQ, MSG_CMD_EVENT_NOTIFY_RSP,
};
public static MsgCmdType valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
return VALUES[desc.getIndex()];
}
private final int index;
private final int value;
private MsgCmdType(int index, int value) {
this.index = index;
this.value = value;
}
static {
Comm.getDescriptor();
}
// @@protoc_insertion_point(enum_scope:org.jeecg.modules.pm.entity.eps.MsgCmdType)
}
public static final class TriggerResult extends
com.google.protobuf.GeneratedMessage {
// Use TriggerResult.newBuilder() to construct.
private TriggerResult() {
initFields();
}
private TriggerResult(boolean noInit) {}
private static final TriggerResult defaultInstance;
public static TriggerResult getDefaultInstance() {
return defaultInstance;
}
public TriggerResult getDefaultInstanceForType() {
return defaultInstance;
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return Comm.internal_static_org_jeecg_modules_pm_entity_eps_TriggerResult_descriptor;
}
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return Comm.internal_static_org_jeecg_modules_pm_entity_eps_TriggerResult_fieldAccessorTable;
}
// required int32 trigger_type = 1;
public static final int TRIGGER_TYPE_FIELD_NUMBER = 1;
private boolean hasTriggerType;
private int triggerType_ = 0;
public boolean hasTriggerType() { return hasTriggerType; }
public int getTriggerType() { return triggerType_; }
// repeated int32 trigger_ret = 2;
public static final int TRIGGER_RET_FIELD_NUMBER = 2;
private java.util.List<Integer> triggerRet_ =
java.util.Collections.emptyList();
public java.util.List<Integer> getTriggerRetList() {
return triggerRet_;
}
public int getTriggerRetCount() { return triggerRet_.size(); }
public int getTriggerRet(int index) {
return triggerRet_.get(index);
}
// required string trigger_time = 3;
public static final int TRIGGER_TIME_FIELD_NUMBER = 3;
private boolean hasTriggerTime;
private String triggerTime_ = "";
public boolean hasTriggerTime() { return hasTriggerTime; }
public String getTriggerTime() { return triggerTime_; }
// optional string trigger_info = 33;
public static final int TRIGGER_INFO_FIELD_NUMBER = 33;
private boolean hasTriggerInfo;
private String triggerInfo_ = "";
public boolean hasTriggerInfo() { return hasTriggerInfo; }
public String getTriggerInfo() { return triggerInfo_; }
// optional string err_msg = 34;
public static final int ERR_MSG_FIELD_NUMBER = 34;
private boolean hasErrMsg;
private String errMsg_ = "";
public boolean hasErrMsg() { return hasErrMsg; }
public String getErrMsg() { return errMsg_; }
private void initFields() {
}
public final boolean isInitialized() {
if (!hasTriggerType) return false;
if (!hasTriggerTime) return false;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (hasTriggerType()) {
output.writeInt32(1, getTriggerType());
}
for (int element : getTriggerRetList()) {
output.writeInt32(2, element);
}
if (hasTriggerTime()) {
output.writeString(3, getTriggerTime());
}
if (hasTriggerInfo()) {
output.writeString(33, getTriggerInfo());
}
if (hasErrMsg()) {
output.writeString(34, getErrMsg());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (hasTriggerType()) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(1, getTriggerType());
}
{
int dataSize = 0;
for (int element : getTriggerRetList()) {
dataSize += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(element);
}
size += dataSize;
size += 1 * getTriggerRetList().size();
}
if (hasTriggerTime()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(3, getTriggerTime());
}
if (hasTriggerInfo()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(33, getTriggerInfo());
}
if (hasErrMsg()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(34, getErrMsg());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
public static TriggerResult parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data).buildParsed();
}
public static TriggerResult parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data, extensionRegistry)
.buildParsed();
}
public static TriggerResult parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data).buildParsed();
}
public static TriggerResult parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data, extensionRegistry)
.buildParsed();
}
public static TriggerResult parseFrom(java.io.InputStream input)
throws java.io.IOException {
return newBuilder().mergeFrom(input).buildParsed();
}
public static TriggerResult parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
public static TriggerResult parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
Builder builder = newBuilder();
if (builder.mergeDelimitedFrom(input)) {
return builder.buildParsed();
} else {
return null;
}
}
public static TriggerResult parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
Builder builder = newBuilder();
if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
return builder.buildParsed();
} else {
return null;
}
}
public static TriggerResult parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return newBuilder().mergeFrom(input).buildParsed();
}
public static TriggerResult parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(TriggerResult prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> {
private TriggerResult result;
// Construct using org.jeecg.modules.pm.entity.eps.Comm.TriggerResult.newBuilder()
private Builder() {}
private static Builder create() {
Builder builder = new Builder();
builder.result = new TriggerResult();
return builder;
}
protected TriggerResult internalGetResult() {
return result;
}
public Builder clear() {
if (result == null) {
throw new IllegalStateException(
"Cannot call clear() after build().");
}
result = new TriggerResult();
return this;
}
public Builder clone() {
return create().mergeFrom(result);
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return TriggerResult.getDescriptor();
}
public TriggerResult getDefaultInstanceForType() {
return TriggerResult.getDefaultInstance();
}
public boolean isInitialized() {
return result.isInitialized();
}
public TriggerResult build() {
if (result != null && !isInitialized()) {
throw newUninitializedMessageException(result);
}
return buildPartial();
}
private TriggerResult buildParsed()
throws com.google.protobuf.InvalidProtocolBufferException {
if (!isInitialized()) {
throw newUninitializedMessageException(
result).asInvalidProtocolBufferException();
}
return buildPartial();
}
public TriggerResult buildPartial() {
if (result == null) {
throw new IllegalStateException(
"build() has already been called on this Builder.");
}
if (result.triggerRet_ != java.util.Collections.EMPTY_LIST) {
result.triggerRet_ =
java.util.Collections.unmodifiableList(result.triggerRet_);
}
TriggerResult returnMe = result;
result = null;
return returnMe;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof TriggerResult) {
return mergeFrom((TriggerResult)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(TriggerResult other) {
if (other == TriggerResult.getDefaultInstance()) return this;
if (other.hasTriggerType()) {
setTriggerType(other.getTriggerType());
}
if (!other.triggerRet_.isEmpty()) {
if (result.triggerRet_.isEmpty()) {
result.triggerRet_ = new java.util.ArrayList<Integer>();
}
result.triggerRet_.addAll(other.triggerRet_);
}
if (other.hasTriggerTime()) {
setTriggerTime(other.getTriggerTime());
}
if (other.hasTriggerInfo()) {
setTriggerInfo(other.getTriggerInfo());
}
if (other.hasErrMsg()) {
setErrMsg(other.getErrMsg());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder(
this.getUnknownFields());
while (true) {
int tag = input.readTag();
switch (tag) {
case 0:
this.setUnknownFields(unknownFields.build());
return this;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
this.setUnknownFields(unknownFields.build());
return this;
}
break;
}
case 8: {
setTriggerType(input.readInt32());
break;
}
case 16: {
addTriggerRet(input.readInt32());
break;
}
case 18: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
while (input.getBytesUntilLimit() > 0) {
addTriggerRet(input.readInt32());
}
input.popLimit(limit);
break;
}
case 26: {
setTriggerTime(input.readString());
break;
}
case 266: {
setTriggerInfo(input.readString());
break;
}
case 274: {
setErrMsg(input.readString());
break;
}
}
}
}
// required int32 trigger_type = 1;
public boolean hasTriggerType() {
return result.hasTriggerType();
}
public int getTriggerType() {
return result.getTriggerType();
}
public Builder setTriggerType(int value) {
result.hasTriggerType = true;
result.triggerType_ = value;
return this;
}
public Builder clearTriggerType() {
result.hasTriggerType = false;
result.triggerType_ = 0;
return this;
}
// repeated int32 trigger_ret = 2;
public java.util.List<Integer> getTriggerRetList() {
return java.util.Collections.unmodifiableList(result.triggerRet_);
}
public int getTriggerRetCount() {
return result.getTriggerRetCount();
}
public int getTriggerRet(int index) {
return result.getTriggerRet(index);
}
public Builder setTriggerRet(int index, int value) {
result.triggerRet_.set(index, value);
return this;
}
public Builder addTriggerRet(int value) {
if (result.triggerRet_.isEmpty()) {
result.triggerRet_ = new java.util.ArrayList<Integer>();
}
result.triggerRet_.add(value);
return this;
}
public Builder addAllTriggerRet(
Iterable<? extends Integer> values) {
if (result.triggerRet_.isEmpty()) {
result.triggerRet_ = new java.util.ArrayList<Integer>();
}
super.addAll(values, result.triggerRet_);
return this;
}
public Builder clearTriggerRet() {
result.triggerRet_ = java.util.Collections.emptyList();
return this;
}
// required string trigger_time = 3;
public boolean hasTriggerTime() {
return result.hasTriggerTime();
}
public String getTriggerTime() {
return result.getTriggerTime();
}
public Builder setTriggerTime(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasTriggerTime = true;
result.triggerTime_ = value;
return this;
}
public Builder clearTriggerTime() {
result.hasTriggerTime = false;
result.triggerTime_ = getDefaultInstance().getTriggerTime();
return this;
}
// optional string trigger_info = 33;
public boolean hasTriggerInfo() {
return result.hasTriggerInfo();
}
public String getTriggerInfo() {
return result.getTriggerInfo();
}
public Builder setTriggerInfo(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasTriggerInfo = true;
result.triggerInfo_ = value;
return this;
}
public Builder clearTriggerInfo() {
result.hasTriggerInfo = false;
result.triggerInfo_ = getDefaultInstance().getTriggerInfo();
return this;
}
// optional string err_msg = 34;
public boolean hasErrMsg() {
return result.hasErrMsg();
}
public String getErrMsg() {
return result.getErrMsg();
}
public Builder setErrMsg(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasErrMsg = true;
result.errMsg_ = value;
return this;
}
public Builder clearErrMsg() {
result.hasErrMsg = false;
result.errMsg_ = getDefaultInstance().getErrMsg();
return this;
}
// @@protoc_insertion_point(builder_scope:org.jeecg.modules.pm.entity.eps.TriggerResult)
}
static {
defaultInstance = new TriggerResult(true);
Comm.internalForceInit();
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jeecg.modules.pm.entity.eps.TriggerResult)
}
public static final class CommEventTrig extends
com.google.protobuf.GeneratedMessage {
// Use CommEventTrig.newBuilder() to construct.
private CommEventTrig() {
initFields();
}
private CommEventTrig(boolean noInit) {}
private static final CommEventTrig defaultInstance;
public static CommEventTrig getDefaultInstance() {
return defaultInstance;
}
public CommEventTrig getDefaultInstanceForType() {
return defaultInstance;
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return Comm.internal_static_org_jeecg_modules_pm_entity_eps_CommEventTrig_descriptor;
}
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return Comm.internal_static_org_jeecg_modules_pm_entity_eps_CommEventTrig_fieldAccessorTable;
}
// required int32 trigger_type = 1;
public static final int TRIGGER_TYPE_FIELD_NUMBER = 1;
private boolean hasTriggerType;
private int triggerType_ = 0;
public boolean hasTriggerType() { return hasTriggerType; }
public int getTriggerType() { return triggerType_; }
// required bytes trigger_info = 2;
public static final int TRIGGER_INFO_FIELD_NUMBER = 2;
private boolean hasTriggerInfo;
private com.google.protobuf.ByteString triggerInfo_ = com.google.protobuf.ByteString.EMPTY;
public boolean hasTriggerInfo() { return hasTriggerInfo; }
public com.google.protobuf.ByteString getTriggerInfo() { return triggerInfo_; }
private void initFields() {
}
public final boolean isInitialized() {
if (!hasTriggerType) return false;
if (!hasTriggerInfo) return false;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (hasTriggerType()) {
output.writeInt32(1, getTriggerType());
}
if (hasTriggerInfo()) {
output.writeBytes(2, getTriggerInfo());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (hasTriggerType()) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(1, getTriggerType());
}
if (hasTriggerInfo()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getTriggerInfo());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
public static CommEventTrig parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data).buildParsed();
}
public static CommEventTrig parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data, extensionRegistry)
.buildParsed();
}
public static CommEventTrig parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data).buildParsed();
}
public static CommEventTrig parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data, extensionRegistry)
.buildParsed();
}
public static CommEventTrig parseFrom(java.io.InputStream input)
throws java.io.IOException {
return newBuilder().mergeFrom(input).buildParsed();
}
public static CommEventTrig parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
public static CommEventTrig parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
Builder builder = newBuilder();
if (builder.mergeDelimitedFrom(input)) {
return builder.buildParsed();
} else {
return null;
}
}
public static CommEventTrig parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
Builder builder = newBuilder();
if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
return builder.buildParsed();
} else {
return null;
}
}
public static CommEventTrig parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return newBuilder().mergeFrom(input).buildParsed();
}
public static CommEventTrig parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(CommEventTrig prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> {
private CommEventTrig result;
// Construct using org.jeecg.modules.pm.entity.eps.Comm.CommEventTrig.newBuilder()
private Builder() {}
private static Builder create() {
Builder builder = new Builder();
builder.result = new CommEventTrig();
return builder;
}
protected CommEventTrig internalGetResult() {
return result;
}
public Builder clear() {
if (result == null) {
throw new IllegalStateException(
"Cannot call clear() after build().");
}
result = new CommEventTrig();
return this;
}
public Builder clone() {
return create().mergeFrom(result);
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return CommEventTrig.getDescriptor();
}
public CommEventTrig getDefaultInstanceForType() {
return CommEventTrig.getDefaultInstance();
}
public boolean isInitialized() {
return result.isInitialized();
}
public CommEventTrig build() {
if (result != null && !isInitialized()) {
throw newUninitializedMessageException(result);
}
return buildPartial();
}
private CommEventTrig buildParsed()
throws com.google.protobuf.InvalidProtocolBufferException {
if (!isInitialized()) {
throw newUninitializedMessageException(
result).asInvalidProtocolBufferException();
}
return buildPartial();
}
public CommEventTrig buildPartial() {
if (result == null) {
throw new IllegalStateException(
"build() has already been called on this Builder.");
}
CommEventTrig returnMe = result;
result = null;
return returnMe;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof CommEventTrig) {
return mergeFrom((CommEventTrig)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(CommEventTrig other) {
if (other == CommEventTrig.getDefaultInstance()) return this;
if (other.hasTriggerType()) {
setTriggerType(other.getTriggerType());
}
if (other.hasTriggerInfo()) {
setTriggerInfo(other.getTriggerInfo());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder(
this.getUnknownFields());
while (true) {
int tag = input.readTag();
switch (tag) {
case 0:
this.setUnknownFields(unknownFields.build());
return this;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
this.setUnknownFields(unknownFields.build());
return this;
}
break;
}
case 8: {
setTriggerType(input.readInt32());
break;
}
case 18: {
setTriggerInfo(input.readBytes());
break;
}
}
}
}
// required int32 trigger_type = 1;
public boolean hasTriggerType() {
return result.hasTriggerType();
}
public int getTriggerType() {
return result.getTriggerType();
}
public Builder setTriggerType(int value) {
result.hasTriggerType = true;
result.triggerType_ = value;
return this;
}
public Builder clearTriggerType() {
result.hasTriggerType = false;
result.triggerType_ = 0;
return this;
}
// required bytes trigger_info = 2;
public boolean hasTriggerInfo() {
return result.hasTriggerInfo();
}
public com.google.protobuf.ByteString getTriggerInfo() {
return result.getTriggerInfo();
}
public Builder setTriggerInfo(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
result.hasTriggerInfo = true;
result.triggerInfo_ = value;
return this;
}
public Builder clearTriggerInfo() {
result.hasTriggerInfo = false;
result.triggerInfo_ = getDefaultInstance().getTriggerInfo();
return this;
}
// @@protoc_insertion_point(builder_scope:org.jeecg.modules.pm.entity.eps.CommEventTrig)
}
static {
defaultInstance = new CommEventTrig(true);
Comm.internalForceInit();
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jeecg.modules.pm.entity.eps.CommEventTrig)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_org_jeecg_modules_pm_entity_eps_TriggerResult_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_org_jeecg_modules_pm_entity_eps_TriggerResult_fieldAccessorTable;
private static com.google.protobuf.Descriptors.Descriptor
internal_static_org_jeecg_modules_pm_entity_eps_CommEventTrig_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_org_jeecg_modules_pm_entity_eps_CommEventTrig_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
String[] descriptorData = {
"\n\ncomm.proto\022\037org.jeecg.modules.pm.entit" +
"y.eps\"w\n\rTriggerResult\022\024\n\014trigger_type\030\001" +
" \002(\005\022\023\n\013trigger_ret\030\002 \003(\005\022\024\n\014trigger_tim" +
"e\030\003 \002(\t\022\024\n\014trigger_info\030! \001(\t\022\017\n\007err_msg" +
"\030\" \001(\t\";\n\rCommEventTrig\022\024\n\014trigger_type\030" +
"\001 \002(\005\022\024\n\014trigger_info\030\002 \002(\014*\201\001\n\nEventSta" +
"te\022\027\n\023EVENT_STATE_INSTANT\020\000\022\025\n\021EVENT_STA" +
"TE_START\020\001\022\024\n\020EVENT_STATE_STOP\020\002\022\025\n\021EVEN" +
"T_STATE_PULSE\020\003\022\026\n\022EVENT_STATE_UPDATE\020\004*" +
"\321\001\n\nMsgCmdType\022\027\n\021MSG_CMD_TYPE_MASK\020\200\376\003\022",
"\031\n\024MSG_CMD_MANUAL_EVENT\020\201\002\022\032\n\025MSG_CMD_CO" +
"NFIRM_EVENT\020\202\002\022\031\n\024MSG_CMD_REPORT_EVENT\020\201" +
"\004\022\032\n\025MSG_CMD_SUBRECV_EVENT\020\202\004\022\035\n\030MSG_CMD" +
"_EVENT_NOTIFY_REQ\020\201\006\022\035\n\030MSG_CMD_EVENT_NO" +
"TIFY_RSP\020\202\006"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_org_jeecg_modules_pm_entity_eps_TriggerResult_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_org_jeecg_modules_pm_entity_eps_TriggerResult_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jeecg_modules_pm_entity_eps_TriggerResult_descriptor,
new String[] { "TriggerType", "TriggerRet", "TriggerTime", "TriggerInfo", "ErrMsg", },
TriggerResult.class,
TriggerResult.Builder.class);
internal_static_org_jeecg_modules_pm_entity_eps_CommEventTrig_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_org_jeecg_modules_pm_entity_eps_CommEventTrig_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jeecg_modules_pm_entity_eps_CommEventTrig_descriptor,
new String[] { "TriggerType", "TriggerInfo", },
CommEventTrig.class,
CommEventTrig.Builder.class);
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
public static void internalForceInit() {}
// @@protoc_insertion_point(outer_class_scope)
}
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: event_dis.proto
package org.jeecg.modules.pm.entity.eps;
public final class EventDis {
private EventDis() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public static final class CommEventLog extends
com.google.protobuf.GeneratedMessage {
// Use CommEventLog.newBuilder() to construct.
private CommEventLog() {
initFields();
}
private CommEventLog(boolean noInit) {}
private static final CommEventLog defaultInstance;
public static CommEventLog getDefaultInstance() {
return defaultInstance;
}
public CommEventLog getDefaultInstanceForType() {
return defaultInstance;
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return EventDis.internal_static_org_jeecg_modules_pm_entity_eps_CommEventLog_descriptor;
}
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return EventDis.internal_static_org_jeecg_modules_pm_entity_eps_CommEventLog_fieldAccessorTable;
}
// required string log_id = 1;
public static final int LOG_ID_FIELD_NUMBER = 1;
private boolean hasLogId;
private String logId_ = "";
public boolean hasLogId() { return hasLogId; }
public String getLogId() { return logId_; }
// required int32 event_state = 2;
public static final int EVENT_STATE_FIELD_NUMBER = 2;
private boolean hasEventState;
private int eventState_ = 0;
public boolean hasEventState() { return hasEventState; }
public int getEventState() { return eventState_; }
// optional int32 event_level = 3;
public static final int EVENT_LEVEL_FIELD_NUMBER = 3;
private boolean hasEventLevel;
private int eventLevel_ = 0;
public boolean hasEventLevel() { return hasEventLevel; }
public int getEventLevel() { return eventLevel_; }
// optional string unit_idx = 4;
public static final int UNIT_IDX_FIELD_NUMBER = 4;
private boolean hasUnitIdx;
private String unitIdx_ = "";
public boolean hasUnitIdx() { return hasUnitIdx; }
public String getUnitIdx() { return unitIdx_; }
// optional int32 event_type = 5;
public static final int EVENT_TYPE_FIELD_NUMBER = 5;
private boolean hasEventType;
private int eventType_ = 0;
public boolean hasEventType() { return hasEventType; }
public int getEventType() { return eventType_; }
// optional string event_type_name = 6;
public static final int EVENT_TYPE_NAME_FIELD_NUMBER = 6;
private boolean hasEventTypeName;
private String eventTypeName_ = "";
public boolean hasEventTypeName() { return hasEventTypeName; }
public String getEventTypeName() { return eventTypeName_; }
// optional int32 sub_sys_type = 7;
public static final int SUB_SYS_TYPE_FIELD_NUMBER = 7;
private boolean hasSubSysType;
private int subSysType_ = 0;
public boolean hasSubSysType() { return hasSubSysType; }
public int getSubSysType() { return subSysType_; }
// optional string event_name = 8;
public static final int EVENT_NAME_FIELD_NUMBER = 8;
private boolean hasEventName;
private String eventName_ = "";
public boolean hasEventName() { return hasEventName; }
public String getEventName() { return eventName_; }
// optional string start_time = 9;
public static final int START_TIME_FIELD_NUMBER = 9;
private boolean hasStartTime;
private String startTime_ = "";
public boolean hasStartTime() { return hasStartTime; }
public String getStartTime() { return startTime_; }
// optional string stop_time = 10;
public static final int STOP_TIME_FIELD_NUMBER = 10;
private boolean hasStopTime;
private String stopTime_ = "";
public boolean hasStopTime() { return hasStopTime; }
public String getStopTime() { return stopTime_; }
// optional string source_idx = 11;
public static final int SOURCE_IDX_FIELD_NUMBER = 11;
private boolean hasSourceIdx;
private String sourceIdx_ = "";
public boolean hasSourceIdx() { return hasSourceIdx; }
public String getSourceIdx() { return sourceIdx_; }
// optional int32 source_type = 12;
public static final int SOURCE_TYPE_FIELD_NUMBER = 12;
private boolean hasSourceType;
private int sourceType_ = 0;
public boolean hasSourceType() { return hasSourceType; }
public int getSourceType() { return sourceType_; }
// optional string source_name = 13;
public static final int SOURCE_NAME_FIELD_NUMBER = 13;
private boolean hasSourceName;
private String sourceName_ = "";
public boolean hasSourceName() { return hasSourceName; }
public String getSourceName() { return sourceName_; }
// optional string log_txt = 14;
public static final int LOG_TXT_FIELD_NUMBER = 14;
private boolean hasLogTxt;
private String logTxt_ = "";
public boolean hasLogTxt() { return hasLogTxt; }
public String getLogTxt() { return logTxt_; }
// optional string region_idx = 15;
public static final int REGION_IDX_FIELD_NUMBER = 15;
private boolean hasRegionIdx;
private String regionIdx_ = "";
public boolean hasRegionIdx() { return hasRegionIdx; }
public String getRegionIdx() { return regionIdx_; }
// optional bytes ext_info = 20;
public static final int EXT_INFO_FIELD_NUMBER = 20;
private boolean hasExtInfo;
private com.google.protobuf.ByteString extInfo_ = com.google.protobuf.ByteString.EMPTY;
public boolean hasExtInfo() { return hasExtInfo; }
public com.google.protobuf.ByteString getExtInfo() { return extInfo_; }
// repeated int32 user_id = 21;
public static final int USER_ID_FIELD_NUMBER = 21;
private java.util.List<Integer> userId_ =
java.util.Collections.emptyList();
public java.util.List<Integer> getUserIdList() {
return userId_;
}
public int getUserIdCount() { return userId_.size(); }
public int getUserId(int index) {
return userId_.get(index);
}
// repeated .org.jeecg.modules.pm.entity.eps.TriggerResult rslt_msg = 33;
public static final int RSLT_MSG_FIELD_NUMBER = 33;
private java.util.List<Comm.TriggerResult> rsltMsg_ =
java.util.Collections.emptyList();
public java.util.List<Comm.TriggerResult> getRsltMsgList() {
return rsltMsg_;
}
public int getRsltMsgCount() { return rsltMsg_.size(); }
public Comm.TriggerResult getRsltMsg(int index) {
return rsltMsg_.get(index);
}
// repeated .org.jeecg.modules.pm.entity.eps.CommEventTrig trig_info = 34;
public static final int TRIG_INFO_FIELD_NUMBER = 34;
private java.util.List<Comm.CommEventTrig> trigInfo_ =
java.util.Collections.emptyList();
public java.util.List<Comm.CommEventTrig> getTrigInfoList() {
return trigInfo_;
}
public int getTrigInfoCount() { return trigInfo_.size(); }
public Comm.CommEventTrig getTrigInfo(int index) {
return trigInfo_.get(index);
}
private void initFields() {
}
public final boolean isInitialized() {
if (!hasLogId) return false;
if (!hasEventState) return false;
for (Comm.TriggerResult element : getRsltMsgList()) {
if (!element.isInitialized()) return false;
}
for (Comm.CommEventTrig element : getTrigInfoList()) {
if (!element.isInitialized()) return false;
}
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (hasLogId()) {
output.writeString(1, getLogId());
}
if (hasEventState()) {
output.writeInt32(2, getEventState());
}
if (hasEventLevel()) {
output.writeInt32(3, getEventLevel());
}
if (hasUnitIdx()) {
output.writeString(4, getUnitIdx());
}
if (hasEventType()) {
output.writeInt32(5, getEventType());
}
if (hasEventTypeName()) {
output.writeString(6, getEventTypeName());
}
if (hasSubSysType()) {
output.writeInt32(7, getSubSysType());
}
if (hasEventName()) {
output.writeString(8, getEventName());
}
if (hasStartTime()) {
output.writeString(9, getStartTime());
}
if (hasStopTime()) {
output.writeString(10, getStopTime());
}
if (hasSourceIdx()) {
output.writeString(11, getSourceIdx());
}
if (hasSourceType()) {
output.writeInt32(12, getSourceType());
}
if (hasSourceName()) {
output.writeString(13, getSourceName());
}
if (hasLogTxt()) {
output.writeString(14, getLogTxt());
}
if (hasRegionIdx()) {
output.writeString(15, getRegionIdx());
}
if (hasExtInfo()) {
output.writeBytes(20, getExtInfo());
}
for (int element : getUserIdList()) {
output.writeInt32(21, element);
}
for (Comm.TriggerResult element : getRsltMsgList()) {
output.writeMessage(33, element);
}
for (Comm.CommEventTrig element : getTrigInfoList()) {
output.writeMessage(34, element);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (hasLogId()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(1, getLogId());
}
if (hasEventState()) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, getEventState());
}
if (hasEventLevel()) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(3, getEventLevel());
}
if (hasUnitIdx()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(4, getUnitIdx());
}
if (hasEventType()) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(5, getEventType());
}
if (hasEventTypeName()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(6, getEventTypeName());
}
if (hasSubSysType()) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(7, getSubSysType());
}
if (hasEventName()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(8, getEventName());
}
if (hasStartTime()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(9, getStartTime());
}
if (hasStopTime()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(10, getStopTime());
}
if (hasSourceIdx()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(11, getSourceIdx());
}
if (hasSourceType()) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(12, getSourceType());
}
if (hasSourceName()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(13, getSourceName());
}
if (hasLogTxt()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(14, getLogTxt());
}
if (hasRegionIdx()) {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(15, getRegionIdx());
}
if (hasExtInfo()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(20, getExtInfo());
}
{
int dataSize = 0;
for (int element : getUserIdList()) {
dataSize += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(element);
}
size += dataSize;
size += 2 * getUserIdList().size();
}
for (Comm.TriggerResult element : getRsltMsgList()) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(33, element);
}
for (Comm.CommEventTrig element : getTrigInfoList()) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(34, element);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
public static CommEventLog parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data).buildParsed();
}
public static CommEventLog parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data, extensionRegistry)
.buildParsed();
}
public static CommEventLog parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data).buildParsed();
}
public static CommEventLog parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data, extensionRegistry)
.buildParsed();
}
public static CommEventLog parseFrom(java.io.InputStream input)
throws java.io.IOException {
return newBuilder().mergeFrom(input).buildParsed();
}
public static CommEventLog parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
public static CommEventLog parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
Builder builder = newBuilder();
if (builder.mergeDelimitedFrom(input)) {
return builder.buildParsed();
} else {
return null;
}
}
public static CommEventLog parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
Builder builder = newBuilder();
if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
return builder.buildParsed();
} else {
return null;
}
}
public static CommEventLog parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return newBuilder().mergeFrom(input).buildParsed();
}
public static CommEventLog parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(CommEventLog prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> {
private CommEventLog result;
// Construct using org.jeecg.modules.pm.entity.eps.EventDis.CommEventLog.newBuilder()
private Builder() {}
private static Builder create() {
Builder builder = new Builder();
builder.result = new CommEventLog();
return builder;
}
protected CommEventLog internalGetResult() {
return result;
}
public Builder clear() {
if (result == null) {
throw new IllegalStateException(
"Cannot call clear() after build().");
}
result = new CommEventLog();
return this;
}
public Builder clone() {
return create().mergeFrom(result);
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return CommEventLog.getDescriptor();
}
public CommEventLog getDefaultInstanceForType() {
return CommEventLog.getDefaultInstance();
}
public boolean isInitialized() {
return result.isInitialized();
}
public CommEventLog build() {
if (result != null && !isInitialized()) {
throw newUninitializedMessageException(result);
}
return buildPartial();
}
private CommEventLog buildParsed()
throws com.google.protobuf.InvalidProtocolBufferException {
if (!isInitialized()) {
throw newUninitializedMessageException(
result).asInvalidProtocolBufferException();
}
return buildPartial();
}
public CommEventLog buildPartial() {
if (result == null) {
throw new IllegalStateException(
"build() has already been called on this Builder.");
}
if (result.userId_ != java.util.Collections.EMPTY_LIST) {
result.userId_ =
java.util.Collections.unmodifiableList(result.userId_);
}
if (result.rsltMsg_ != java.util.Collections.EMPTY_LIST) {
result.rsltMsg_ =
java.util.Collections.unmodifiableList(result.rsltMsg_);
}
if (result.trigInfo_ != java.util.Collections.EMPTY_LIST) {
result.trigInfo_ =
java.util.Collections.unmodifiableList(result.trigInfo_);
}
CommEventLog returnMe = result;
result = null;
return returnMe;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof CommEventLog) {
return mergeFrom((CommEventLog)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(CommEventLog other) {
if (other == CommEventLog.getDefaultInstance()) return this;
if (other.hasLogId()) {
setLogId(other.getLogId());
}
if (other.hasEventState()) {
setEventState(other.getEventState());
}
if (other.hasEventLevel()) {
setEventLevel(other.getEventLevel());
}
if (other.hasUnitIdx()) {
setUnitIdx(other.getUnitIdx());
}
if (other.hasEventType()) {
setEventType(other.getEventType());
}
if (other.hasEventTypeName()) {
setEventTypeName(other.getEventTypeName());
}
if (other.hasSubSysType()) {
setSubSysType(other.getSubSysType());
}
if (other.hasEventName()) {
setEventName(other.getEventName());
}
if (other.hasStartTime()) {
setStartTime(other.getStartTime());
}
if (other.hasStopTime()) {
setStopTime(other.getStopTime());
}
if (other.hasSourceIdx()) {
setSourceIdx(other.getSourceIdx());
}
if (other.hasSourceType()) {
setSourceType(other.getSourceType());
}
if (other.hasSourceName()) {
setSourceName(other.getSourceName());
}
if (other.hasLogTxt()) {
setLogTxt(other.getLogTxt());
}
if (other.hasRegionIdx()) {
setRegionIdx(other.getRegionIdx());
}
if (other.hasExtInfo()) {
setExtInfo(other.getExtInfo());
}
if (!other.userId_.isEmpty()) {
if (result.userId_.isEmpty()) {
result.userId_ = new java.util.ArrayList<Integer>();
}
result.userId_.addAll(other.userId_);
}
if (!other.rsltMsg_.isEmpty()) {
if (result.rsltMsg_.isEmpty()) {
result.rsltMsg_ = new java.util.ArrayList<Comm.TriggerResult>();
}
result.rsltMsg_.addAll(other.rsltMsg_);
}
if (!other.trigInfo_.isEmpty()) {
if (result.trigInfo_.isEmpty()) {
result.trigInfo_ = new java.util.ArrayList<Comm.CommEventTrig>();
}
result.trigInfo_.addAll(other.trigInfo_);
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder(
this.getUnknownFields());
while (true) {
int tag = input.readTag();
switch (tag) {
case 0:
this.setUnknownFields(unknownFields.build());
return this;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
this.setUnknownFields(unknownFields.build());
return this;
}
break;
}
case 10: {
setLogId(input.readString());
break;
}
case 16: {
setEventState(input.readInt32());
break;
}
case 24: {
setEventLevel(input.readInt32());
break;
}
case 34: {
setUnitIdx(input.readString());
break;
}
case 40: {
setEventType(input.readInt32());
break;
}
case 50: {
setEventTypeName(input.readString());
break;
}
case 56: {
setSubSysType(input.readInt32());
break;
}
case 66: {
setEventName(input.readString());
break;
}
case 74: {
setStartTime(input.readString());
break;
}
case 82: {
setStopTime(input.readString());
break;
}
case 90: {
setSourceIdx(input.readString());
break;
}
case 96: {
setSourceType(input.readInt32());
break;
}
case 106: {
setSourceName(input.readString());
break;
}
case 114: {
setLogTxt(input.readString());
break;
}
case 122: {
setRegionIdx(input.readString());
break;
}
case 162: {
setExtInfo(input.readBytes());
break;
}
case 168: {
addUserId(input.readInt32());
break;
}
case 170: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
while (input.getBytesUntilLimit() > 0) {
addUserId(input.readInt32());
}
input.popLimit(limit);
break;
}
case 266: {
Comm.TriggerResult.Builder subBuilder = Comm.TriggerResult.newBuilder();
input.readMessage(subBuilder, extensionRegistry);
addRsltMsg(subBuilder.buildPartial());
break;
}
case 274: {
Comm.CommEventTrig.Builder subBuilder = Comm.CommEventTrig.newBuilder();
input.readMessage(subBuilder, extensionRegistry);
addTrigInfo(subBuilder.buildPartial());
break;
}
}
}
}
// required string log_id = 1;
public boolean hasLogId() {
return result.hasLogId();
}
public String getLogId() {
return result.getLogId();
}
public Builder setLogId(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasLogId = true;
result.logId_ = value;
return this;
}
public Builder clearLogId() {
result.hasLogId = false;
result.logId_ = getDefaultInstance().getLogId();
return this;
}
// required int32 event_state = 2;
public boolean hasEventState() {
return result.hasEventState();
}
public int getEventState() {
return result.getEventState();
}
public Builder setEventState(int value) {
result.hasEventState = true;
result.eventState_ = value;
return this;
}
public Builder clearEventState() {
result.hasEventState = false;
result.eventState_ = 0;
return this;
}
// optional int32 event_level = 3;
public boolean hasEventLevel() {
return result.hasEventLevel();
}
public int getEventLevel() {
return result.getEventLevel();
}
public Builder setEventLevel(int value) {
result.hasEventLevel = true;
result.eventLevel_ = value;
return this;
}
public Builder clearEventLevel() {
result.hasEventLevel = false;
result.eventLevel_ = 0;
return this;
}
// optional string unit_idx = 4;
public boolean hasUnitIdx() {
return result.hasUnitIdx();
}
public String getUnitIdx() {
return result.getUnitIdx();
}
public Builder setUnitIdx(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasUnitIdx = true;
result.unitIdx_ = value;
return this;
}
public Builder clearUnitIdx() {
result.hasUnitIdx = false;
result.unitIdx_ = getDefaultInstance().getUnitIdx();
return this;
}
// optional int32 event_type = 5;
public boolean hasEventType() {
return result.hasEventType();
}
public int getEventType() {
return result.getEventType();
}
public Builder setEventType(int value) {
result.hasEventType = true;
result.eventType_ = value;
return this;
}
public Builder clearEventType() {
result.hasEventType = false;
result.eventType_ = 0;
return this;
}
// optional string event_type_name = 6;
public boolean hasEventTypeName() {
return result.hasEventTypeName();
}
public String getEventTypeName() {
return result.getEventTypeName();
}
public Builder setEventTypeName(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasEventTypeName = true;
result.eventTypeName_ = value;
return this;
}
public Builder clearEventTypeName() {
result.hasEventTypeName = false;
result.eventTypeName_ = getDefaultInstance().getEventTypeName();
return this;
}
// optional int32 sub_sys_type = 7;
public boolean hasSubSysType() {
return result.hasSubSysType();
}
public int getSubSysType() {
return result.getSubSysType();
}
public Builder setSubSysType(int value) {
result.hasSubSysType = true;
result.subSysType_ = value;
return this;
}
public Builder clearSubSysType() {
result.hasSubSysType = false;
result.subSysType_ = 0;
return this;
}
// optional string event_name = 8;
public boolean hasEventName() {
return result.hasEventName();
}
public String getEventName() {
return result.getEventName();
}
public Builder setEventName(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasEventName = true;
result.eventName_ = value;
return this;
}
public Builder clearEventName() {
result.hasEventName = false;
result.eventName_ = getDefaultInstance().getEventName();
return this;
}
// optional string start_time = 9;
public boolean hasStartTime() {
return result.hasStartTime();
}
public String getStartTime() {
return result.getStartTime();
}
public Builder setStartTime(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasStartTime = true;
result.startTime_ = value;
return this;
}
public Builder clearStartTime() {
result.hasStartTime = false;
result.startTime_ = getDefaultInstance().getStartTime();
return this;
}
// optional string stop_time = 10;
public boolean hasStopTime() {
return result.hasStopTime();
}
public String getStopTime() {
return result.getStopTime();
}
public Builder setStopTime(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasStopTime = true;
result.stopTime_ = value;
return this;
}
public Builder clearStopTime() {
result.hasStopTime = false;
result.stopTime_ = getDefaultInstance().getStopTime();
return this;
}
// optional string source_idx = 11;
public boolean hasSourceIdx() {
return result.hasSourceIdx();
}
public String getSourceIdx() {
return result.getSourceIdx();
}
public Builder setSourceIdx(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasSourceIdx = true;
result.sourceIdx_ = value;
return this;
}
public Builder clearSourceIdx() {
result.hasSourceIdx = false;
result.sourceIdx_ = getDefaultInstance().getSourceIdx();
return this;
}
// optional int32 source_type = 12;
public boolean hasSourceType() {
return result.hasSourceType();
}
public int getSourceType() {
return result.getSourceType();
}
public Builder setSourceType(int value) {
result.hasSourceType = true;
result.sourceType_ = value;
return this;
}
public Builder clearSourceType() {
result.hasSourceType = false;
result.sourceType_ = 0;
return this;
}
// optional string source_name = 13;
public boolean hasSourceName() {
return result.hasSourceName();
}
public String getSourceName() {
return result.getSourceName();
}
public Builder setSourceName(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasSourceName = true;
result.sourceName_ = value;
return this;
}
public Builder clearSourceName() {
result.hasSourceName = false;
result.sourceName_ = getDefaultInstance().getSourceName();
return this;
}
// optional string log_txt = 14;
public boolean hasLogTxt() {
return result.hasLogTxt();
}
public String getLogTxt() {
return result.getLogTxt();
}
public Builder setLogTxt(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasLogTxt = true;
result.logTxt_ = value;
return this;
}
public Builder clearLogTxt() {
result.hasLogTxt = false;
result.logTxt_ = getDefaultInstance().getLogTxt();
return this;
}
// optional string region_idx = 15;
public boolean hasRegionIdx() {
return result.hasRegionIdx();
}
public String getRegionIdx() {
return result.getRegionIdx();
}
public Builder setRegionIdx(String value) {
if (value == null) {
throw new NullPointerException();
}
result.hasRegionIdx = true;
result.regionIdx_ = value;
return this;
}
public Builder clearRegionIdx() {
result.hasRegionIdx = false;
result.regionIdx_ = getDefaultInstance().getRegionIdx();
return this;
}
// optional bytes ext_info = 20;
public boolean hasExtInfo() {
return result.hasExtInfo();
}
public com.google.protobuf.ByteString getExtInfo() {
return result.getExtInfo();
}
public Builder setExtInfo(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
result.hasExtInfo = true;
result.extInfo_ = value;
return this;
}
public Builder clearExtInfo() {
result.hasExtInfo = false;
result.extInfo_ = getDefaultInstance().getExtInfo();
return this;
}
// repeated int32 user_id = 21;
public java.util.List<Integer> getUserIdList() {
return java.util.Collections.unmodifiableList(result.userId_);
}
public int getUserIdCount() {
return result.getUserIdCount();
}
public int getUserId(int index) {
return result.getUserId(index);
}
public Builder setUserId(int index, int value) {
result.userId_.set(index, value);
return this;
}
public Builder addUserId(int value) {
if (result.userId_.isEmpty()) {
result.userId_ = new java.util.ArrayList<Integer>();
}
result.userId_.add(value);
return this;
}
public Builder addAllUserId(
Iterable<? extends Integer> values) {
if (result.userId_.isEmpty()) {
result.userId_ = new java.util.ArrayList<Integer>();
}
super.addAll(values, result.userId_);
return this;
}
public Builder clearUserId() {
result.userId_ = java.util.Collections.emptyList();
return this;
}
// repeated .org.jeecg.modules.pm.entity.eps.TriggerResult rslt_msg = 33;
public java.util.List<Comm.TriggerResult> getRsltMsgList() {
return java.util.Collections.unmodifiableList(result.rsltMsg_);
}
public int getRsltMsgCount() {
return result.getRsltMsgCount();
}
public Comm.TriggerResult getRsltMsg(int index) {
return result.getRsltMsg(index);
}
public Builder setRsltMsg(int index, Comm.TriggerResult value) {
if (value == null) {
throw new NullPointerException();
}
result.rsltMsg_.set(index, value);
return this;
}
public Builder setRsltMsg(int index, Comm.TriggerResult.Builder builderForValue) {
result.rsltMsg_.set(index, builderForValue.build());
return this;
}
public Builder addRsltMsg(Comm.TriggerResult value) {
if (value == null) {
throw new NullPointerException();
}
if (result.rsltMsg_.isEmpty()) {
result.rsltMsg_ = new java.util.ArrayList<Comm.TriggerResult>();
}
result.rsltMsg_.add(value);
return this;
}
public Builder addRsltMsg(Comm.TriggerResult.Builder builderForValue) {
if (result.rsltMsg_.isEmpty()) {
result.rsltMsg_ = new java.util.ArrayList<Comm.TriggerResult>();
}
result.rsltMsg_.add(builderForValue.build());
return this;
}
public Builder addAllRsltMsg(
Iterable<? extends Comm.TriggerResult> values) {
if (result.rsltMsg_.isEmpty()) {
result.rsltMsg_ = new java.util.ArrayList<Comm.TriggerResult>();
}
super.addAll(values, result.rsltMsg_);
return this;
}
public Builder clearRsltMsg() {
result.rsltMsg_ = java.util.Collections.emptyList();
return this;
}
// repeated .org.jeecg.modules.pm.entity.eps.CommEventTrig trig_info = 34;
public java.util.List<Comm.CommEventTrig> getTrigInfoList() {
return java.util.Collections.unmodifiableList(result.trigInfo_);
}
public int getTrigInfoCount() {
return result.getTrigInfoCount();
}
public Comm.CommEventTrig getTrigInfo(int index) {
return result.getTrigInfo(index);
}
public Builder setTrigInfo(int index, Comm.CommEventTrig value) {
if (value == null) {
throw new NullPointerException();
}
result.trigInfo_.set(index, value);
return this;
}
public Builder setTrigInfo(int index, Comm.CommEventTrig.Builder builderForValue) {
result.trigInfo_.set(index, builderForValue.build());
return this;
}
public Builder addTrigInfo(Comm.CommEventTrig value) {
if (value == null) {
throw new NullPointerException();
}
if (result.trigInfo_.isEmpty()) {
result.trigInfo_ = new java.util.ArrayList<Comm.CommEventTrig>();
}
result.trigInfo_.add(value);
return this;
}
public Builder addTrigInfo(Comm.CommEventTrig.Builder builderForValue) {
if (result.trigInfo_.isEmpty()) {
result.trigInfo_ = new java.util.ArrayList<Comm.CommEventTrig>();
}
result.trigInfo_.add(builderForValue.build());
return this;
}
public Builder addAllTrigInfo(
Iterable<? extends Comm.CommEventTrig> values) {
if (result.trigInfo_.isEmpty()) {
result.trigInfo_ = new java.util.ArrayList<Comm.CommEventTrig>();
}
super.addAll(values, result.trigInfo_);
return this;
}
public Builder clearTrigInfo() {
result.trigInfo_ = java.util.Collections.emptyList();
return this;
}
// @@protoc_insertion_point(builder_scope:org.jeecg.modules.pm.entity.eps.CommEventLog)
}
static {
defaultInstance = new CommEventLog(true);
EventDis.internalForceInit();
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jeecg.modules.pm.entity.eps.CommEventLog)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_org_jeecg_modules_pm_entity_eps_CommEventLog_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_org_jeecg_modules_pm_entity_eps_CommEventLog_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
String[] descriptorData = {
"\n\017event_dis.proto\022\037org.jeecg.modules.pm." +
"entity.eps\032\ncomm.proto\"\343\003\n\014CommEventLog\022" +
"\016\n\006log_id\030\001 \002(\t\022\023\n\013event_state\030\002 \002(\005\022\023\n\013" +
"event_level\030\003 \001(\005\022\020\n\010unit_idx\030\004 \001(\t\022\022\n\ne" +
"vent_type\030\005 \001(\005\022\027\n\017event_type_name\030\006 \001(\t" +
"\022\024\n\014sub_sys_type\030\007 \001(\005\022\022\n\nevent_name\030\010 \001" +
"(\t\022\022\n\nstart_time\030\t \001(\t\022\021\n\tstop_time\030\n \001(" +
"\t\022\022\n\nsource_idx\030\013 \001(\t\022\023\n\013source_type\030\014 \001" +
"(\005\022\023\n\013source_name\030\r \001(\t\022\017\n\007log_txt\030\016 \001(\t" +
"\022\022\n\nregion_idx\030\017 \001(\t\022\020\n\010ext_info\030\024 \001(\014\022\017",
"\n\007user_id\030\025 \003(\005\022@\n\010rslt_msg\030! \003(\0132..org." +
"jeecg.modules.pm.entity.eps.TriggerResul" +
"t\022A\n\ttrig_info\030\" \003(\0132..org.jeecg.modules" +
".pm.entity.eps.CommEventTrig"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_org_jeecg_modules_pm_entity_eps_CommEventLog_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_org_jeecg_modules_pm_entity_eps_CommEventLog_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jeecg_modules_pm_entity_eps_CommEventLog_descriptor,
new String[] { "LogId", "EventState", "EventLevel", "UnitIdx", "EventType", "EventTypeName", "SubSysType", "EventName", "StartTime", "StopTime", "SourceIdx", "SourceType", "SourceName", "LogTxt", "RegionIdx", "ExtInfo", "UserId", "RsltMsg", "TrigInfo", },
CommEventLog.class,
CommEventLog.Builder.class);
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
Comm.getDescriptor(),
}, assigner);
}
public static void internalForceInit() {}
// @@protoc_insertion_point(outer_class_scope)
}
//package org.jeecg.modules.pm.handler;
//
//import org.apache.activemq.ActiveMQConnectionFactory;
//import org.apache.activemq.command.ActiveMQTopic;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.jms.annotation.EnableJms;
//import org.springframework.jms.listener.DefaultMessageListenerContainer;
//
//import javax.jms.ConnectionFactory;
//import javax.jms.Topic;
//
///**
// * @author: JJww
// * @Date:2022/3/25
// */
//@EnableJms
//@Configuration
//public class ActiveMqConfig {
//
//
// private final static String VSS_TOPIC = "openapi.vss.topic";
//
// private final static String EPS_TOPIC = "openapi.eps.topic";
//
// @Bean(name = "topic")
// public Topic topic() {
// return new ActiveMQTopic(VSS_TOPIC);
// }
//
// @Bean
// public ConnectionFactory connectionFactory() {
// return new ActiveMQConnectionFactory("tcp://172.16.16.2:61618");
// }
//
//
// @Bean
// public DefaultMessageListenerContainer defaultMessageListenerContainer(ConnectionFactory connectionFactory) {
// final DefaultMessageListenerContainer defaultMessageListenerContainer = new DefaultMessageListenerContainer();
// defaultMessageListenerContainer.setDestinationName(VSS_TOPIC);
// defaultMessageListenerContainer.setConnectionFactory(connectionFactory);
// defaultMessageListenerContainer.setMessageListener(vssMssageListener);
// defaultMessageListenerContainer.setPubSubDomain(true);
// return defaultMessageListenerContainer;
// }
//
//
// public ActiveMQConnectionFactory activeMQConnectionFactory(){
//
// }
//
//
//}
package org.jeecg.modules.pm.handler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.ErrorHandler;
/**
* @author: JJww
* @Date:2022/3/25
*/
@Slf4j
@Service
public class EventErrorHandler implements ErrorHandler {
@Override
public void handleError(Throwable t) {
log.error("Error in listener", t);
}
}
//package org.jeecg.modules.pm.handler;
//
//
//import com.google.protobuf.ByteString;
//import lombok.extern.slf4j.Slf4j;
//import org.jeecg.modules.pm.entity.eps.EventDis;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.jms.annotation.JmsListener;
//import org.springframework.jms.core.JmsMessagingTemplate;
//import org.springframework.stereotype.Component;
//
//import javax.jms.BytesMessage;
//import javax.jms.Message;
//
///**
// * @author: JJww
// * @Date:2022/3/23
// */
//@Slf4j
//@Component
//public class EventMessageListener {
//
// @JmsListener(destination = "openapi.vss.topic", containerFactory = "topicListener")
// public void vssMessageListener(Message msg) throws Exception {
//
// try {
// // cms里发送的消息为BytesMessage,此处不做判断亦可
// if (msg instanceof BytesMessage) {
// BytesMessage bytesMessage = (BytesMessage) msg;
// long length = bytesMessage.getBodyLength();
// byte[] bt = new byte[(int) length];
// // 将BytesMessage转换为byte类型
// bytesMessage.readBytes(bt);
// // 壳文件字段,EventDis类为event_dis.proto文件解析而来,CommEventLog类为事件壳文件类
// EventDis.CommEventLog parseFrom = EventDis.CommEventLog.parseFrom(bt);
// // 输出壳文件字段
// // System.out.println(parseFrom.toString());
// // 扩展字段,此字段为设备上报事件内容,部分事件需要使用pb文件再次解析
// ByteString extInfo = parseFrom.getExtInfo();
// // 输出扩展字段
// // System.out.println(extInfo.toStringUtf8());
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
//}
package org.jeecg.modules.pm.handler;
import com.google.protobuf.ByteString;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.jeecg.modules.pm.entity.eps.EventDis;
import javax.jms.*;
/**
* @author: JJww
* @Date:2022/3/28
*/
public class VssMssageListener {
/**
* 10.33.47.176:61618和openapi.vss.topic可通过openapi【事件订阅接口】获得
*/
public static final String BROKER_URL = "failover:(tcp://172.16.16.2:61618)?timeout=2000";
/**
* 10.33.47.176:61618和openapi.vss.topic可通过openapi【事件订阅接口】获得
*/
public static final String TARGET = "openapi.vss.topic";
public static void run() {
Connection connection = null;
Session session = null;
try {
// 创建链接工厂
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(BROKER_URL);
// 通过工厂创建一个连接
connection = factory.createConnection();
// factory.createConnection(userName, password)
// 启动连接
connection.start();
// 第一个参数表示是否使用事务,第二个参数指定消息的确认模式
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic(TARGET);
MessageConsumer consumer = session.createConsumer(topic);
// 消费者异步接收topic里的消息
consumer.setMessageListener(new MessageListener() {
public void onMessage(Message msg) {
try {
// cms里发送的消息为BytesMessage,此处不做判断亦可
if (msg instanceof BytesMessage) {
BytesMessage bytesMessage = (BytesMessage) msg;
long length = bytesMessage.getBodyLength();
byte[] bt = new byte[(int) length];
// 将BytesMessage转换为byte类型
bytesMessage.readBytes(bt);
// 壳文件字段,EventDis类为event_dis.proto文件解析而来,CommEventLog类为事件壳文件类
EventDis.CommEventLog parseFrom = EventDis.CommEventLog.parseFrom(bt);
// 输出壳文件字段
System.out.println(parseFrom.toString());
// 扩展字段,此字段为设备上报事件内容,部分事件需要使用pb文件再次解析
ByteString extInfo = parseFrom.getExtInfo();
// 输出扩展字段
System.out.println(extInfo.toStringUtf8());
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
System.out.println("ActiveMQ开始监听");
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package org.jeecg;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.pm.handler.VssMssageListener;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
......@@ -18,7 +20,7 @@ import java.net.UnknownHostException;
*/
@Slf4j
@SpringBootApplication(exclude = {MongoAutoConfiguration.class})
public class JeecgSystemApplication extends SpringBootServletInitializer {
public class JeecgSystemApplication extends SpringBootServletInitializer implements CommandLineRunner {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
......@@ -31,6 +33,7 @@ public class JeecgSystemApplication extends SpringBootServletInitializer {
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
VssMssageListener.run();
log.info("\n----------------------------------------------------------\n\t" +
"Application Jeecg-Boot is running! Access URLs:\n\t" +
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
......@@ -40,4 +43,8 @@ public class JeecgSystemApplication extends SpringBootServletInitializer {
}
@Override
public void run(String... args) throws Exception {
VssMssageListener.run();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment