research-virtualfortknox / msb-client-websocket-java Goto Github PK
View Code? Open in Web Editor NEWThe java client library to connect to the websocket interface of the MSB (Manufacturing Service Bus)
License: Apache License 2.0
The java client library to connect to the websocket interface of the MSB (Manufacturing Service Bus)
License: Apache License 2.0
Receiving an Object containing a Map (i.e. Map<Integer, CustomObject> via MSB function handler is not possible, because the data will be deserialized with an empty map.
When we receive the same JSON as a String (not as typed object) and perform the marshalling JSON to java object manually in our code, we can get the desired Map with all items mentioned in the JSON String.
Tested with:
Python websocket client -> MSB -> Java websocket client
Java websocket client -> MSB -> Java websocket client
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When receiving a Map (or HashMap) the data should be deserialized as a filled Map with all the transmitted content (all items mentioned in the received JSON). This must be the case for Objects containing nested Maps (or HashMaps), too.
Environment:
Additional context
########################################################
@Log // lombok
@Component
@FunctionHandler(path = "/functionhandler")
public class MSBFunctionHandler {
@FunctionCall(path = "/update", description = "", name = "update")
public void update(@FunctionParam(name = "sortedItems") SortedItems sortedItems) throws Exception {
log.info("List was empty: " + sortedItems.getTheListWithItems().isEmpty());
}
@FunctionCall(path = "/updateWithJSON", description = "", name = "updateWithJSON")
public void updateWithJSON(@FunctionParam(name = "sortedItems") String jsonInput) throws Exception {
log.fine("############# RAW JSON #############\n\n" + jsonInput + "\n\n");
try {
ObjectMapper mapper = new ObjectMapper();
TypeReference<SortedItems> typeRef
= new TypeReference<SortedItems>() {};
SortedItems items = mapper.readValue(jsonInput, typeRef);
update(items);
} catch (Exception e) {
log.severe("Cannot handle raw JSON! " + e.getMessage() + "\n\n" + jsonInput + "\n\n");
throw e;
}
}
}
########################################################
@Data // lombok
public class SortedItems {
Map<Integer, YourObject> theListWithItems;
}
########################################################
@Data // lombok
public class YourObject {
private String foo;
private double bar;
}
Describe the bug
If a function with defined response event returns null this will not be catched and an event without data will be generated.
Expected behavior
This can lead to errors in consuming services, so if the return value is null, no event should be generated and an error should be logged instead.
Environment (please complete the following information):
MSB client version v1.0.5
Describe the bug
The MSB Client does not show any console log output if the application is a plain java application. If you add @SpringBootApplication and spring dependencies to pom.xml the output works.
Console is showing
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
To Reproduce
Dependencies of pom.xml of plain java app:
<dependencies>
<dependency>
<groupId>com.github.research-virtualfortknox</groupId>
<artifactId>msb-client-websocket</artifactId>
<version>1.0.2-RELEASE</version>
</dependency>
</dependencies>
Dependencies of spring app:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.research-virtualfortknox</groupId>
<artifactId>msb-client-websocket</artifactId>
<version>1.0.2-RELEASE</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.29</version>
</dependency>
</dependencies>
Expected behavior
MSB Client should print logs to console if used in plain java applications.
Environment (please complete the following information):
Describe the bug
If the connection is closed on the server side during the first registration, the connection is re-established, but the registration is not executed again. The client then hangs on this state.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The client should run the regsitrieung again.
Environment (please complete the following information):
Additional context
error.log
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.