callback - Java-Gearman-Service - Handle GearmanJobEventCallback::onEvent and byte[] in GearmanFunction -


I am using Gearman to distribute different functions and therefore I use to implement clients and workers I am doing

Understand the data obtained in GearmanJobEventCallback & lt;

However, I understand

  • and
  • I can not find ; T & gt; :: onEvent :

    How can I change the byte array to event.getData () data? Like situation or back data? When I send the position (3, 10) it gives a byte array [51,0,49,48] - it is not very useful for my client, unserializing with ObjectInputStream does not seem successful.

    How can I "decode" with the return data of the work method?

    How do I "decode" work method by gearman function

    to data logic (byte Array) Any input will be greatly appreciated! D

    I have found a way to solve it, hopefully That it helps anyone, who comes into this problem.

      string number = ""; String denominator Str = ""; Boolean Writer = True; (For Byte B: event.getData ()) {if (b == 0) {writeNumerator = false; to continue; } If (written number) {numeratorStr + = (char) b; } Else {denominatorStr + = (char) b; }} Int numerator = integer Persian (numeratorStr); Int denominator = integer. Den (denominatorStr);   

    It seems that byte array values ​​are entries from an ASCII table and put together in a byte array:

    Hope it helps :)

Comments