https://github.com/moesif/moesif-wsclient-example
Examples in Java and Scala of sending events to Moesif using WS Client.
https://github.com/moesif/moesif-wsclient-example
Last synced: 7 months ago
JSON representation
Examples in Java and Scala of sending events to Moesif using WS Client.
- Host: GitHub
- URL: https://github.com/moesif/moesif-wsclient-example
- Owner: Moesif
- Created: 2022-07-14T00:47:53.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-07-15T17:40:35.000Z (about 3 years ago)
- Last Synced: 2025-01-05T21:11:51.752Z (9 months ago)
- Language: Java
- Size: 14.6 KB
- Stars: 1
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Moesif Play WS Client Example
[Moesif](https://www.moesif.com) is an API analytics and monitoring
platform. MoesifWsClientExample is a sample program which makes and
sends a sample event to Moesif.[Standalone Play WS](https://github.com/playframework/play-ws) is an async HTTP client with fluent API.
It is part of [Play Framework](https://www.playframework.com/documentation/2.8.x/JavaWS)This repository contains an example in Java and in Scala to send events to Moesif.
[See Moesif documentation](https://www.moesif.com/docs/api#log-an-api-call)## How to run this example
Send single event to Moesif (Java):
```bash
sbt "runMain com.moesif.sdk.sample.wsclient.MoesifWsClientExample "
```Send single event to Moesif (Scala):
```bash
sbt "runMain com.moesif.sdk.sample.wsclient.scala.MoesifWsClientScalaExample "
```Send a batch of events (Java):
```bash
sbt "runMain com.moesif.sdk.sample.wsclient.MoesifWsClientBatchExample "
```Your Moesif Collector Application Id can be found in the
[_Moesif Portal_](https://www.moesif.com/). After signing up for a
Moesif account, your Moesif Application Id will be displayed during
the onboarding steps.You can always find your Moesif Collector Application Id at any time
by logging into the [_Moesif Portal_](https://www.moesif.com/), clicking
on the bottom left user profile, and then clicking _API Keys_.
\
After running the example, you can now view events from Moesif Event Log### How to run unit tests
```bash
sbt test
```
## Tested versionsMoesif has validated MoesifWsClientExample against the following combinations:
| Scala | Play WS |
|---------------|------------------|
| Scala 2.11.12 | 2.7.9 |
| Scala 2.12.16 | 2.7.9
2.8.16 |
| Scala 2.13.8 | 2.7.9
2.8.16 |### Future Updates
* Incorporate examples of building Moesif event using jackson and gson
* Add example for sending events in batch