-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'onupdate-remodelled' into onupdate-resultlogging
- Loading branch information
Showing
24 changed files
with
699 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/se/yolean/kafka/keyvalue/onupdate/HttpTargetRequestInvoker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package se.yolean.kafka.keyvalue.onupdate; | ||
|
||
import java.util.concurrent.Future; | ||
|
||
import javax.ws.rs.core.Response; | ||
|
||
import se.yolean.kafka.keyvalue.UpdateRecord; | ||
|
||
public interface HttpTargetRequestInvoker { | ||
|
||
Future<Response> postUpdate(UpdateRecord update); | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/se/yolean/kafka/keyvalue/onupdate/HttpTargetRequestInvokerJersey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package se.yolean.kafka.keyvalue.onupdate; | ||
|
||
import java.util.concurrent.Future; | ||
|
||
import javax.ws.rs.client.AsyncInvoker; | ||
import javax.ws.rs.client.Client; | ||
import javax.ws.rs.client.ClientBuilder; | ||
import javax.ws.rs.client.Entity; | ||
import javax.ws.rs.client.WebTarget; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.Response; | ||
|
||
import org.glassfish.jersey.client.ClientConfig; | ||
import org.glassfish.jersey.client.ClientProperties; | ||
|
||
import se.yolean.kafka.keyvalue.UpdateRecord; | ||
|
||
/** | ||
* To configure timeouts we need to know which JAX-RS impl we're using: | ||
* | ||
* https://stackoverflow.com/questions/22672664/setting-request-timeout-for-jax-rs-2-0-client-api | ||
*/ | ||
public class HttpTargetRequestInvokerJersey implements HttpTargetRequestInvoker { | ||
|
||
private AsyncInvoker async; | ||
|
||
public HttpTargetRequestInvokerJersey( | ||
String onupdateTargetUrl, | ||
int connectTimeoutMilliseconds, | ||
int readTimeoutMilliseconds) { | ||
ClientConfig configuration = new ClientConfig(); | ||
configuration.property(ClientProperties.CONNECT_TIMEOUT, connectTimeoutMilliseconds); | ||
configuration.property(ClientProperties.READ_TIMEOUT, readTimeoutMilliseconds); | ||
Client client = ClientBuilder.newClient(configuration); | ||
|
||
WebTarget target = client.target(onupdateTargetUrl); | ||
this.async = target.request().async(); | ||
} | ||
|
||
@Override | ||
public Future<Response> postUpdate(UpdateRecord update) { | ||
return async.post(Entity.entity(update, MediaType.APPLICATION_JSON_TYPE)); | ||
} | ||
|
||
} |
49 changes: 0 additions & 49 deletions
49
src/main/java/se/yolean/kafka/keyvalue/onupdate/OnUpdateFactory.java
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
src/main/java/se/yolean/kafka/keyvalue/onupdate/OnUpdateHttpIgnoreResult.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.