MFP8 Adapter Response compression - ibm-mobilefirst

Using MFP8 now, Earlier version was having compressResponse true for adapter. how to use that in MFP 8 ?
Am getting huge JSON object for a particular webservice, I need to know the size of the JSON in KB within adapter before returning to client side.

Compression on adapter response is available in MFP 8.0 as well and is enabled by default.
The default adapter response compression threshold is 20480 bytes ( 20 KB).
To configure the value, in the MobileFirst Operations Console, navigate to Runtime Settings -> Runtime Properties -> GZIP compression threshold for adapter responses.
Edit the default value to configure your own threshold.

Related

SASL support in WSO2 Stream Processor / Siddhi

Qs (1) Does Siddhi application support connecting to Kafka using SASL_SSL protocol with PLAIN as SASL Mechanism.
Qs (2) If not what SASL options are available. I am using WSO2 Streaming Processor 4.4.
Below is a simple program that's expected to read from a Kafka topic and write the content as is on server console.
Note-1: The connections establishes just fine (Deployment on worker node is also successful). But nothing reflected on console.
Note:2: The program runs just fine if connected to a non secure Kafka cluster (I remove the optional.configuration and change the bootstrap servers value appropriately)
#App:name("SKAppOne")
#source(
type='kafka',
topic.list='skapp1',
group.id='g1',
partition.no.list='0',
threading.option='single.thread',
bootstrap.servers='**KAFKABROKERIP:KAFKABROKERPORT**',
optional.configuration=
***"sasl.mechanism:PLAIN,security.protocol:SASL_SSL,***
sasl.jaas.config:org.apache.kafka.common.security.plain.PlainLoginModule required username='**validuserid**' password='**validpassword**';,
ssl.truststore.location:**validlocationfor_client.truststore.jks file**,
ssl.truststore.password:**validpassword**,
ssl.keystore.location:**validlocationfor_server.keystore.jks file**,
ssl.keystore.password:**validpassword**,
ssl.key.password:**validpassword**",
#map(type='json'))
define stream InputStreamFromSecureKafka (name string, location string);
#sink(type='log')
define stream SOutputStreamToConsole (name string, location string);
#info(name='kafkatosconsole')
from InputStreamFromSecureKafka
select *
insert into SOutputStreamToConsole;

How to access IBM MobileFirst 7.1 default attribute store in session independent mode

I am working on migrating a IBM MobileFirst 6.3 project to version 7.1 and enabling the 7.1 session independent mode. I have specified the attribute store as the worklight default runtime database.
In the previous version I have used HTTPSession object in HTTP JavaScript adapters to dynamically store some minimal data related to the current user session as shown in the sample code below.
var request = WL.Server.getClientRequest();
var session = request.getSession();
session.setAttribute("ID", "123");
session.setAttribute("UserName", "xxx");
As I cannot use session object anymore, are there any WL.Server APIs available for explicitly store/retrieve/remove data from the default attribute store (WL run-time database)? Couldn't find any examples on this. Please advise. Thanks.
Knowledge center documents this scenario and solution for 7.1 Session Independent mode here
https://www.ibm.com/support/knowledgecenter/en/SSHS8R_7.1.0/com.ibm.worklight.dev.doc/devref/c_java_server_side_api.html#java_server_side_api__java_rest
Saving applicative state between requests in Java RESTful adapters
In versions earlier than V7.1.0, developers were able to store the applicative state in the HTTP session, by using the session object, namely request.getSession() (see WL.Server).
If you are working in session-independent mode that became available starting with IBM MobileFirst Platform Foundation V7.1.0, the applicative state of the adapter must be persisted outside the session, for example, by using a database such as Cloudant®
Sample also is attached in the link above.

IBM Mobilefirst uploading .wlapp gives Throwable Connection Closed within 1 minute

i'm using liberty 8.5.5.5 and database DB2 10.5 and MobileFirst 7.1
While i'm uploading wlapp file(file size 50mb and above) in worklight console it says
Throwable Connection Closed : Read failed. Possible end of stream encountered, while redirecting request to http://XX.XX.XX.XX:9080/wladmin/management-apint-apis/1.0/runtimes/sample/applications?async=true
kindly let me know, what can be the maximum size of .wlapp file that i can upload to IBM Mobilefirst console
During upload an error is throwing approximately in 1 minute. Is there a way to increase the timeout in configuration.
Kindly advice.
There is no filesize restriction for .wlapp files.
Note that an iFix was recently publishing handling the timeout values when uploading .wlapp files via the console: http://www-01.ibm.com/support/docview.wss?uid=swg1PI59605
Make sure you are using an iFix level that is greater than 2016-03-23.
You can verify your iFix build number in the console's About screen.

OOM Exception with MTOM client

I am working on transfer large size file, and finally ended with MTOM implementation. we created MTOM enabled web service and client, and tested the client as a plain Java program. and we were able to send 1 GB file successfully. the main point here the heap at client place were not even increasing more than 70 MB.
But when I tried to initiate the same call from web-logic container (means created web client), we end up with below OOM Exception.
at
weblogic.utils.io.UnsyncByteArrayOutputStream.resizeBuffer(UnsyncByteArrayOutputStream.java:59)
at weblogic.utils.io.UnsyncByteArrayOutputStream.write(UnsyncByteArrayOutputStream.java:89)
at javax.activation.DataHandler.writeTo(DataHandler.java:293)
at com.sun.xml.ws.encoding.MtomCodec$ByteArrayBuffer.write(MtomCodec.java:196)
at com.sun.xml.ws.encoding.MtomCodec.encode(MtomCodec.java:163)
at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:258)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:142)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:86)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.client.Stub.process(Stub.java:248)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
at $Proxy101.uploadFile(Unknown Source)
anyu one have any idea
UPDATE: it seems the MTOM settings are not effective when we run the program in web-logic container ! but still I am not able to find the solution
UPDATE 2: it seems weblogic is not supporting streaming ! I will update the weblogic version and update the ticket, till them wish me luck..
Add this additional Java/JVM Option in setDomainEnv.sh
EXTRA_JAVA_PROPERTIES="-DUseSunHttpHandler=true ${EXTRA_JAVA_PROPERTIES}"
export EXTRA_JAVA_PROPERTIES
switches from weblogic specific (weblogic.net.http.HttpURLConnection) to sun's HTTP handler.
This solved my issue.
Refer:
Changing HttpURLConnection in running jvm
http://atgtipsandtweaks.blogspot.com/2011/11/weblogicjava-httphandler-issues.html
Thanks!

Glassfish 3.1 Maximum URI Length

I'm having this error when using a long GET request:
SEVERE: GRIZZLY0039: Request URI is
too large.
java.nio.BufferOverflowException
What is the configuration I have to change for Glassfish 3.1?
I tried changing these parameters but had no success :
- header-buffer-length-bytes (through admin console)
- request-body-buffer-size-bytes (in domain.xml)
Thanks.
We had the same problem while deploying a large application into a cluster (standalone deployment was working). A solution, that worked for us was to increase the TCP buffer size.
In the administration console change
'Configurations -> cluster-config -> Network Config -> Transports -> tcp -> Buffer Size' to 131072 or more.
Hope that helps. -- Wintermute