Both methods are used to receive messages from the VPN
what are the differences between them?
The basic distinction between the two is where you consume messages from on the broker.
createFlow() creates a FlowReceiver for a guaranteed messaging endpoint - a queue or a topic endpoint.
getMessageConsumer() creates a XMLMessageConsumer - a channel to consume direct messages matching the session’s topic subscriptions. Subscriptions are added to the session using the addSubscription(Subscription s) method.
These tutorials explain using publish subscribe and point-to-point pattern with the Java API: