Question: I have the following code to publish message to RabbitMQ. I am getting AlreadyClosed exception sometimes in production. I would like to reproduce the same issue in my local machine(i.e DEV server). Any idea on how to reproduce it?

```
AMQP.BasicProperties.Builder props = new AMQP.BasicProperties().builder();
props = props.deliveryMode(2).headers(headers);
rabbitChannel.getChannel().basicPublish(exchangeName, routingKey,
                                props.build(), rabbitMessage.serialize());

```

Answer: 
Simply construct a regex:

```
**import re**

rgx = **re.compile(r'category:\s\*(\d+)\s\*;')**
number_list = **rgx.findall(**'category: 33 ; id: AF45DA; category: 54 ; id: KF65YA; category: 60 ; id: XC36IA;'**)**
```

This gives:

```
>>> rgx.findall('category: 33 ; id: AF45DA; category: 54 ; id: KF65YA; category: 60 ; id: XC36IA;')
['33', '54', '60']

```

If you want the result to be `int`s, you can use a `map`:

```
import re

rgx = re.compile(r'category:\s*(\d+)\s*;')
number_list = **list(map(int,**rgx.findall('category: 33 ; id: AF45DA; category: 54 ; id: KF65YA; category: 60 ; id: XC36IA;')**))**
```

This produces:

```
>>> number_list
[33, 54, 60]

```
```
s = "category: 33 ; id: AF45DA; category: 54 ; id: KF65YA; category: 60 ; id: XC36IA;"
s = s.split(";")
number_list = []
for ss in s:
    if "category" in ss:
        number_list.append(int(ss[10:-1]))

```