Solace + protobuf in Android application
Answers
-
It looks like a very similar question was just asked about using Protobuf with IOS and I think Tamimi and Tom's answers should help you get started: https://solace.community/discussion/comment/1006
If that isn't enough to get you started, let us know what you've tried to do so far and we can help out.
0 -
Hi. Yes, I saw this link https://solace.community/discussion/comment/1006. But it didn't help me. Maybe an example can be given for android? Where can I use parameters like:
- login
- password
- host
- and VPN
0 -
-
Please @Tamimi and @TomF can you help me?
https://solace.com/downloads/
Messaging APIs + Protocols (Java) - this for backend? or for all who write on java (backend, android ...) ?0 -
@Evgen you need to decide how the app will communicate with the Solace broker. As Tamimi suggested, MQTT is a good place to start. Once you have your app talking to the broker, you then need to decide how whatever application needs to get the data from the app will talk to the broker. This could be MQTT, JMS or our native Java API.
So, let's start at the app to broker communication. Use our quick starts to get a broker going first. Then use an MQTT API such as Paho to send messages from your app to the broker.
1 -
You can also do a quick search on how to use MQTT with android, one is the Paho Android Services (I never personally used that one before) you can read more about it here https://www.hivemq.com/blog/mqtt-client-library-enyclopedia-paho-android-service/#:~:text=The MQTT connection is encapsulated,to receive MQTT messages reliably.
There are also other Android MQTT services you can leverage. So one path I would recommend
1. Spin up a Soalce broker (as per the quick starts that Tom referred to)
2. Use MQTT Android to connect to the broker
3. Send and receive messages from your Android application over the brokerUsing the Java API from our downloads page will give you more advanced features access, the reason why I suggested MQTT at first is to get familiar with our broker and pubsub workflow. I'm curious to know how your Android application turns out to be and what it is! Would be happy if you update us on it and the progress
Happy programming!
0 -
Thank!
I read this blog:
https://solace.com/blog/event-driven-kotlin-android-app-mqtt-solace-pubsub/But i not found where i can setting vpn for solace;
My Solace broker get me: login/password/host and vpn;
OK.
MQTT i see setting host/login and password but i not found vpn.
This my problem.0 -
@Evgen Did you attempt to connect without the msgVPN (i.e. just using host, username, password)? You can’t set magVPN if using MQTT since “messageVPN” is a Solace concept. When you connect to the broker via mqtt without setting the messageVPN it will default to the first one.
0 -
@Evgen Ah ha! It sounds like you're making progress! The "Message VPN Unavailable" error is often because you're trying to connect to a Message VPN that doesn't exist. If you don't specify a Message VPN, the Solace broker will assume you're trying to use the "default" Message VPN. If you're trying to connect to a Solace Cloud instance, this won't be available - hence the error. It's also possible that you've created, say, a Docker broker instance, and your "default" message VPN is shut down - open up the manager GUI (broker IP at port 8080 in your browser) and check the default Message VPN is "Up." If you are using a cloud plan you will need to specify the message VPN.
0 -
@Tamimi has reminded me that if you're using MQTT you don't specify the Message VPN - that's done by connecting to the correct port number. Nicely done Tamimi!
So, can you share with us what your Message VPN name is, what port number the MQTT service is on that VPN, and your MQTT code?0 -
Hi @Evgen . Did you manage to get your Android app connected to Solace? As explained above, since a "Message VPN" is a Solace concept and not an MQTT one, the way to connect to particular VPNs is specified via the port. If using Solace Cloud, the ports are already assigned. E.g.:
If you are running the Software broker locally, you may need to configure the MQTT port mapping to your VPN. You can find this in the PubSub+ Manager, in the Message VPN -> Services.
Post up some screenshots / code snippets to help us help out..!
Finally, I don't believe the standard Solace Java API (JCSMP) will work with Android. Even though Android is mostly Java. But I haven't tested myself.
0