-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP-Bridge add support for time based subscribes #2539
Conversation
add thread safety use set instead of list
@michaelgrill could you check if my fix for my Pull is now using it correctly? Also please review the Implementations of the Shelly devices if you can? [PullRequest](https://github.com/OpenEMS/openems/pull/2519/files#diff-3d5ae9c7ded7d622bee13862ce0399cbb1d8f040a1fae7f863b6a9e6dddb53f1) |
io.openems.edge.bridge.http/src/io/openems/edge/bridge/http/UrlFetcherImpl.java
Outdated
Show resolved
Hide resolved
io.openems.edge.bridge.http/src/io/openems/edge/bridge/http/api/BridgeHttp.java
Show resolved
Hide resolved
io.openems.edge.bridge.http/src/io/openems/edge/bridge/http/UrlFetcher.java
Outdated
Show resolved
Hide resolved
io.openems.edge.bridge.http/test/io/openems/edge/bridge/http/api/BridgeHttpTest.java
Outdated
Show resolved
Hide resolved
update javadoc
avoid casting
io.openems.edge.bridge.http/src/io/openems/edge/bridge/http/UrlFetcherImpl.java
Outdated
Show resolved
Hide resolved
io.openems.edge.bridge.http/src/io/openems/edge/bridge/http/time/Delay.java
Outdated
Show resolved
Hide resolved
use stream to collect body data
io.openems.edge.bridge.http/src/io/openems/edge/bridge/http/time/DelayTimeProviderChain.java
Outdated
Show resolved
Hide resolved
use ZERO constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you both for the professional code & review! 👍
TRACE(false) // | ||
; | ||
|
||
private final boolean bodyAllowed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelgrill I would just make this public final boolean isBodyAllowed;
- and avoid the getter.
…#2539) - "Fixed" bug where an exception gets throw during deactivation of a component using the HTTP-Bridge (ty @Sn0w3y OpenEMS#2381 (comment)) now to get an instance of a `BridgeHttp` the following code needs to be added ``` @reference private BridgeHttpFactory httpBridgeFactory; private BridgeHttp httpBridge; @activate private void activate() { this.httpBridge = this.httpBridgeFactory.get(); } @deactivate private void deactivate() { this.httpBridgeFactory.unget(this.httpBridge); this.httpBridge = null; } ``` as far as i know the exception which is happening is not intended to happen but for now to avoid unexpected behaviour because of the exception this is the prefered way to use it. - Made CycleSubscriber thread safe to avoid concurrent modification exceptions - Added time based subscribtions simple example to add a subscription with a delay of 1 minute between the calls would be ``` final var delayProvider = DelayTimeProviderChain.fixedDelay(new Delay(1L, TimeUnit.MINUTES); this.httpBridge.subscribeTime(delayProvider, "http://127.0.0.1/status", t -> { // process data }, t -> { // handle error }); ```
now to get an instance of a
BridgeHttp
the following code needs to be addedas far as i know the exception which is happening is not intended to happen but for now to avoid unexpected behaviour because of the exception this is the prefered way to use it.
Made CycleSubscriber thread safe to avoid concurrent modification exceptions
Added time based subscribtions
simple example to add a subscription with a delay of 1 minute between the calls would be