Eventhub Binary message not respect
Nobody has claimed this yet.
Assessment
This issue has not been assessed yet.
Description
When eventhub send binary message, java function app is getting garbled string message
example:
@FunctionName("eventhuexampleCx")
public void eventHubProcessorCx(
@EventHubTrigger(name = "pnrTrigger", eventHubName = "cri-319862312", consumerGroup = "test", connection = "EventHubConnectionAppSetting", cardinality = Cardinality.ONE) String paxHubMsgs,
final ExecutionContext context) {
Logger logger = context.getLogger();
logger.info("***************" + (paxHubMsgs));
byte[] bytes = paxHubMsgs.getBytes();
String message = new String(bytes, StandardCharsets.UTF_16);
logger.info(message);
}

Python script for sending binary message to eventhub
import asyncio
import struct
from azure.eventhub.aio import EventHubProducerClient
from azure.eventhub import EventData
async def run():
# Create a producer client to send messages to the event hub.
# Specify a connection string to your event hubs namespace and
# the event hub name.
producer = EventHubProducerClient.from_connection_string(conn_str="your-event-hub-connection-string", eventhub_name="cri-319862312")
async with producer:
# Create a batch.
event_data_batch = await producer.create_batch()
bin_data = struct.pack('200B', *range(200))
bin_data = b'\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b'
# Add events to the batch.
event_data_batch.add(EventData(bin_data))
# Send the batch of events to the event hub.
await producer.send_batch(event_data_batch)
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
- Dominant language
- Java
- Stars
- 103
- Forks
- 74
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/azure-functions-java-worker
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
mcp-extension
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
mcp-extension
Azure/azure-functions-java-worker#863 · 1 assignee ·
All issues in Azure/azure-functions-java-worker
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100