Skip to content

Commit c1dc853

Browse files
committed
few doc fixes [ci skip]
few fixes to examples in docs, related to deprecated Julia syntax
1 parent 19b037e commit c1dc853

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

SENDRECV.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,41 @@ A message received from a queue can also have the following attributes:
3333
| remaining | Int32 | Number of messages remaining in the queue. |
3434

3535

36-
````julia
36+
```julia
3737
# create a message with 10 bytes of random value as data
3838
msg = Message(rand(UInt8, 10))
3939

4040
# create a persistent plain text message
41-
data = convert(Vector{UInt8}, "hello world")
41+
data = convert(Vector{UInt8}, codeunits("hello world"))
4242
msg = Message(data, content_type="text/plain", delivery_mode=PERSISTENT)
43-
````
43+
```
4444

4545
Messages are published to an exchange, optionally specifying a routing key.
4646

47-
````julia
47+
```julia
4848
EXCG_DIRECT = "MyDirectExcg"
4949
ROUTE1 = "routingkey1"
5050

5151
basic_publish(chan1, msg; exchange=EXCG_DIRECT, routing_key=ROUTE1)
52-
````
52+
```
5353

5454
To poll a queue for messages:
5555

56-
````julia
57-
maybe_msg = basic_get(chan1, QUEUE1, false)
56+
```julia
57+
msg = basic_get(chan1, QUEUE1, false)
5858

5959
# check if we got a message
60-
if !isnull(maybe_msg)
61-
msg = get(maybe_msg)
62-
60+
if msg !== nothing
6361
# process msg...
6462

6563
# acknowledge receipt
6664
basic_ack(chan1, msg.delivery_tag)
6765
end
68-
````
66+
```
6967

7068
To subscribe for messages (register an asynchronous callback):
7169

72-
````julia
70+
```julia
7371
# define a callback function to process messages
7472
function consumer(msg)
7573
# process msg...
@@ -89,4 +87,4 @@ println("consumer registered with tag $consumer_tag")
8987

9088
# unsubscribe the consumer from the queue
9189
basic_cancel(chan1, consumer_tag)
92-
````
90+
```

0 commit comments

Comments
 (0)