Skip to content

Commit

Permalink
Merge pull request #27 from ruedigergad/master
Browse files Browse the repository at this point in the history
Use the ActiveMQ Convention of Distinguishing between TextMessage and BytesMessage
  • Loading branch information
mattrpav authored Aug 15, 2023
2 parents f972bac + dc20a26 commit 1bf81cb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,10 @@ public void run() {
}

public boolean offer(StompFrame frame) {
return this.offer(frame, true);
}

public boolean offer(StompFrame frame, boolean addContentLength) {
getDispatchQueue().assertExecuting();
if( this.transport.full() ) {
return false;
} else {
if( addContentLength && SEND.equals(frame.action()) ) {
frame.addContentLengthHeader();
}
return this.transport.offer(frame);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ public void write(DataOutput out) throws IOException {
write(out, true);
}

public void addContentLengthHeader() {
addHeader(CONTENT_LENGTH, new AsciiBuffer(Integer.toString(content.length())));
}

public int size() {
int rc = action.length() + 1;
if( headerList!=null ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.fusesource.stomp.client.Stomp;
import org.fusesource.stomp.codec.StompFrame;
import org.fusesource.stomp.jms.message.StompJmsMessage;
import org.fusesource.stomp.jms.message.StompJmsTextMessage;
import org.fusesource.stomp.jms.util.StompTranslator;

public class StompChannel {
Expand Down Expand Up @@ -215,7 +216,9 @@ public void sendMessage(StompJmsMessage copy, AsciiBuffer txid, boolean sync) th
copy.onSend();
StompFrame frame = copy.getFrame();
frame.action(SEND);
frame.headerMap().put(CONTENT_LENGTH, new AsciiBuffer(Integer.toString(frame.content().length)));
if (!(copy instanceof StompJmsTextMessage)) {
frame.headerMap().put(CONTENT_LENGTH, new AsciiBuffer(Integer.toString(frame.content().length)));
}
if (txid != null) {
frame.headerMap().put(TRANSACTION, txid);
}
Expand Down

0 comments on commit 1bf81cb

Please sign in to comment.