This is the model of encrypted emails. So see OpenPGP, in particular its open-source implementation GnuPG. With your notations, node B has a public/private key pair, and node A knows the public key of B. Node A asymmetrically encrypts the message with node B's public key, and only node B can decrypt it, using its private key, which no other node knows. When A sends the message, it actually sends it to some repository server (B's "mailbox"), which B will consult when it goes online again. The repository does not have a copy of B's private key, and therefore cannot decrypt the message.
For the encryption process, node A only needs a copy of B's public key, which is public, and does not change; node A can use B's public to encrypt one billion successive messages without any security problem. B's public key does not "wear off" upon usage. Node B needs not be online at any point for the encryption to work.
There are a lot of tricky details to care of when designing a format for asymmetric encryption, so you are warmly encouraged not to do it, and instead rely on some existing protocol (like OpenPGP) which has been thoroughly reviewed by many cryptographers. Similarly, implementation is also a dangerous part, and you cannot test for involuntary data leaks, so reusing some existing code is also a smart move.
The hard part in asymmetric encryption is how to make sure that what node A considers to be "B's public key" is really the public key of B, not a fake public key whose corresponding private key is known to the attacker. Depending on your context, this "making sure" part can be as simple as a one-time configuration, or as complex as a full-blown PKI.