The MQTT binding (or persistence) approach mentioned is of course best, and what is I guess semi supported in openHAB.
The Wiki page on MQTT is a bit lengthy and dives into the fact that there are multiple ways to do things depending on what your needs are. Have a read through the main Wiki page, and the MQTT persistence page to see what is best for you.
https://github.com/openhab/openhab/wiki/MQTT-BindingThat said, if you bind an Item to an MQTT broker and topic, you just need to post an update to that item in the rule and it will publish it for you. A central idea in OpenHAB is to remove the connection part from the "Event Bus" so that you can just deal with items everywhere and not have to question what it is connected to, which type of network, its address, etc.
Greg