kraken-io / kraken-java Goto Github PK
View Code? Open in Web Editor NEWOfficial Kraken.io library for Java
Home Page: https://kraken.io/
License: Apache License 2.0
Official Kraken.io library for Java
Home Page: https://kraken.io/
License: Apache License 2.0
I have been building a batch processing queue and am forced to do some awkward workarounds when dealing with mixed types of AbstractResize.
For example if calling SquareResize and LandscapeResize, I have to resort to a switch to check strategy to set or output the width of the image, either by calling getWidth or getSize.
I have some ideas, but I wanted to open this up for discussion in case there was anything already underway on your end.
sometimes we get an exception from kraken 1.1.x client (1.1.1 also tested) when query with DirectFileUploadRequest:
io.kraken.client.exception.KrakenIoException: Failed to unmarshall response
Aug 17 16:28:11 backbone slika.jar[32570]: at io.kraken.client.impl.DefaultKrakenIoClient.handleResponse(DefaultKrakenIoClient.java:197) ~[client-1.1.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at io.kraken.client.impl.DefaultKrakenIoClient.directUpload(DefaultKrakenIoClient.java:165) ~[client-1.1.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at io.kraken.client.impl.DefaultKrakenIoClient.directUpload(DefaultKrakenIoClient.java:133) ~[client-1.1.1.jar!/:na]
which Caused by:
Caused by: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=text/html;charset=utf-8, type=class io.kraken.client.model.response.AbstractUploadResponse, genericType=class io.kraken.client.model.response.AbstractUploadResponse.
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:208) ~[jersey-common-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:132) ~[jersey-common-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1072) ~[jersey-common-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:882) ~[jersey-common-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:816) ~[jersey-common-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:298) ~[jersey-client-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.client.InboundJaxrsResponse$1.call(InboundJaxrsResponse.java:91) ~[jersey-client-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.internal.Errors.process(Errors.java:292) ~[jersey-common-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.internal.Errors.process(Errors.java:274) ~[jersey-common-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.internal.Errors.process(Errors.java:205) ~[jersey-common-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:365) ~[jersey-common-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.client.InboundJaxrsResponse.runInScopeIfPossible(InboundJaxrsResponse.java:240) ~[jersey-client-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:88) ~[jersey-client-2.30.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: at io.kraken.client.impl.DefaultKrakenIoClient.handleResponse(DefaultKrakenIoClient.java:186) ~[client-1.1.1.jar!/:na]
Aug 17 16:28:11 backbone slika.jar[32570]: ... 80 common frames omitted
as i understood - there is a wrong answer from kraken endpoint, because answer with unexpected "text/html" mime type for jersey client
any ideas?
I appreciate your product, but when the image is big, your server or mine is slow.
Timeouts are reached.
Current timeouts are hardcoding to 3 seconds, can you make it configurable?
I'm talking about DefaultIOKrakenClient class
private Client createClient(ObjectMapper objectMapper) {
final ClientConfig clientConfig = new ClientConfig();
clientConfig.property(ClientProperties.FOLLOW_REDIRECTS, true);
clientConfig.property(ClientProperties.CONNECT_TIMEOUT, 3000);
clientConfig.property(ClientProperties.READ_TIMEOUT, 3000);
clientConfig.property(ClientProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true);
final JacksonJsonProvider jacksonJsonProvider = new JacksonJsonProvider(objectMapper);
final Client client = ClientBuilder.newClient(clientConfig).register(jacksonJsonProvider).register(MultiPartFeature.class);
final Feature feature = new LoggingFeature(JERSEY_LOGGER, Level.FINE, LoggingFeature.Verbosity.PAYLOAD_ANY, null);
client.register(feature);
return client;
}
This library has no support for interaction with the sandbox: https://kraken.io/docs/sandbox
The changes in Java EE makes impossible to use your platform on modern environments like Spring 6, Hibernate 6, Tomcat 10, etc.
More info: https://jakarta.ee/blogs/javax-jakartaee-namespace-ecosystem-progress/
How to solve? Multiple options:
Thanks in advance
As you can see in this page.
https://mvnrepository.com/artifact/io.kraken.client/client/1.1.2
Guava version dependency is very old (2014) and has a couple of security vulnerabilities.
I dont know how hard is to upgrade this dependency, but security should be a priority.
The issues are
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8908
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-10237
We use callback_url approach for processing images
webClient
.postAbs(config.getString("https://api.kraken.io/v1/url"))
.putHeader("Content-Type", "application/json")
.putHeader("Accept", "application/json")
.rxSendStream(Observable.just(buffer))
.doOnError(err -> logger.error("Error while uploading to kraken", err));
We get the success response
HTTP/1.1 200 OK
{
"id": "18fede37617a787649c3f60b9f1f280d"
}
Looks like the submitted job is successful. We can see the kraked images in our s3 buckets. Results are not posted to the specified callback_url
There was a major outage last week as learnt from https://status.kraken.io
Your twitter handle says it's fixed but it's not working
Can you please help us out as it affecting our clients?
My planned usage will run through a proxy server, but with the implementation I don't see a way to configure a proxy for just this API call. The only alternative I see is to configure the proxy using system properties, and this has the downside of being "all or nothing"
The version in the maven dependency is 1.0.0. with no other versions available. This is actually subtly different from the version on GitHub (1.0.1). For example, the documented withDev() method is missing from 1.0.0.
We're looking to use the Java API to do some very basic processing, but it doesn't seem possible to do without specifying a quality and a conversion.
imageUrlUploadCallbackUrlRequest = ImageUrlUploadCallbackUrlRequest
.builder(new URL("http://website.com/images/image.png"),
new URL("http://website.com/somecallback"))
.build();
Throws:
quality is not of a type(s) number; convert is not of a type(s) object
Adding :
.withLossy(false)
into the builder makes no difference: it still complains that the quality is missing.
Will dig into it myself if I get a chance.
While uploading an SVG image I'm getting an Unsupported Media Type exception
DirectUploadRequest directUploadRequest = DirectUploadRequest.builder(new ByteArrayInputStream(input)).build();
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.